Submission #448676

#TimeUsernameProblemLanguageResultExecution timeMemory
448676IvnFTopovi (COCI15_topovi)C++17
30 / 120
1 ms460 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define ull unsigned long long #define fi first #define se second #define ld long double ll n, k, p, arr[105][105]; ll baris[105], kolom[105]; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> k >> p; for(int i=1;i<=k;++i){ ll r, c; cin >> r >> c >> arr[r][c]; baris[r]^=arr[r][c]; kolom[c]^=arr[r][c]; } for(int i=1;i<=p;++i){ ll r1, r2, c1, c2; cin >> r1 >> c1 >> r2 >> c2; baris[r1]^=arr[r1][c1]; kolom[c1]^=arr[r1][c1]; baris[r2]^=arr[r1][c1]; kolom[c2]^=arr[r1][c1]; swap(arr[r1][c1], arr[r2][c2]); ll tmp=0; for(int j=1;j<=n;++j){ for(int k=1;k<=n;++k){ int cur=(baris[j]^arr[j][k]); cur^=(kolom[k]^arr[j][k]); if(cur > 0){ tmp++; } } } cout << tmp << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...