Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- using namespace std;
- ifstream f("matop.in");
- ofstream g("matop.out");
- int n,k,op,lin,col,val;
- int a[25001],b[25001],d[25001];
- int s;
- int main()
- {
- f>>n>>k;
- for(int i=1;i<=k;++i)
- {
- f>>op;
- if(op==1)
- {
- f>>lin>>val;
- if(a[lin]<val)
- {
- if(d[lin]<val)
- s+=(val-d[lin]),d[lin]=val;
- a[lin]=val;
- }
- }
- if(op==2)
- {
- f>>col>>val;
- if(b[col]<val)
- {
- if(d[col]<val)
- s+=(val-d[col]),d[col]=val;
- b[col]=val;
- }
- }
- if(op==3)
- {
- f>>lin>>col;
- g<<max(a[lin],b[col])<<'\n';
- }
- if(op==4)
- {
- g<<s<<'\n';
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement