Submission #98583

#TimeUsernameProblemLanguageResultExecution timeMemory
98583MercenaryTopovi (COCI15_topovi)C++14
120 / 120
1310 ms34348 KiB
#include<bits/stdc++.h> using namespace std; #define taskname "TEST" #define pb push_back typedef long double ld; typedef long long ll; const int maxn = 1e5 + 5; map<int,int> mcol , mrow; map<int,int> cntcol , cntrow; int n , p , k; map<pair<int,int>,int> mmap; #define mp make_pair ll res = 0; void Move(int r , int c , int val){ int &valr = mrow[r];int &valc = mcol[c]; if(valr != valc)res++; res -= 2 * n - cntrow[valc] - cntcol[valr]; cntcol[valc]--; cntrow[valr]--; valr ^= val;valc ^= val; cntcol[valc]++; cntrow[valr]++; res += 2 * n - cntrow[valc] - cntcol[valr]; if(valr != valc)res--; mmap[mp(r,c)] ^= val; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); if(fopen(taskname".INP","r")) freopen(taskname".INP", "r",stdin) , freopen(taskname".OUT", "w",stdout); cin >> n >> k >> p; cntcol[0] = cntrow[0] = n; for(int i = 1 ; i <= k ; ++i) { int r , c , x; cin >> r >> c >> x; Move(r,c,x); } for(int i = 1 ; i <= p ; ++i){ int r1 , c1 , r2 , c2;cin >> r1 >> c1 >> r2 >> c2; int val = mmap[mp(r1,c1)]; Move(r1,c1,val); Move(r2,c2,val); cout << res << '\n'; } }

Compilation message (stderr)

topovi.cpp: In function 'int main()':
topovi.cpp:38:44: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
         freopen(taskname".INP", "r",stdin) ,
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
         freopen(taskname".OUT", "w",stdout);
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
topovi.cpp:38:44: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
#Verdict Execution timeMemoryGrader output
Fetching results...