Submission #230557

#TimeUsernameProblemLanguageResultExecution timeMemory
230557alireza_kavianiTopovi (COCI15_topovi)C++17
120 / 120
878 ms39928 KiB
/* Generated by powerful Codeforces Tool * You can download the binary file in here https://github.com/xalanq/cf-tool (Windows, macOS, Linux) * Author: alireza_kaviani * Time: 2020-05-10 15:06:09 **/ #include <bits/stdc++.h> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>; typedef long long ll; typedef long double ld; typedef pair<ll, ll> pll; #define all(x) (x).begin(),(x).end() #define Sort(x) sort(all((x))) #define X first #define Y second #define sep ' ' #define endl '\n' #define SZ(x) ll(x.size()) ll poww(ll a, ll b, ll md) { return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md)); } const ll MAXN = 1e6 + 10; const ll LOG = 22; const ll INF = 8e18; const ll MOD = 1e9 + 7; // 998244353; // 1e9 + 9; // row : n , col : m ll n , k , p , ans; map<pair<int , int> , int> val; map<int , int> col , row , cntCol , cntRow; void modifyCol(int c , int x){ ans += cntRow[c] * x; cntCol[c] += x; } void modifyRow(int r , int x){ ans += cntCol[r] * x; cntRow[r] += x; } void insert(int r , int c , int x){ int R = (row[r] ^= x) , C = (col[c] ^= x); val[{r , c}] ^= x; modifyRow(R ^ x , -1) ; modifyCol(C ^ x , -1); modifyRow(R , +1) ; modifyCol(C , +1); } int main() { ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); scanf("%lld%lld%lld" , &n , &k , &p); ans = n * n; cntCol[0] = cntRow[0] = n; for(int i = 1 , r , c , x ; i <= k ; i++){ scanf("%d%d%d" , &r , &c , &x); insert(r , c , x); } for(int i = 1 , r1 , c1 , r2 , c2 ; i <= p ; i++){ scanf("%d%d%d%d" , &r1 , &c1 , &r2 , &c2); ll v = val[{r1 , c1}]; insert(r1 , c1 , v); insert(r2 , c2 , v); printf("%lld\n" , n * n - ans); } return 0; } /* */

Compilation message (stderr)

topovi.cpp: In function 'int main()':
topovi.cpp:60:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld%lld%lld" , &n , &k , &p); ans = n * n;
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
topovi.cpp:63:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d%d" , &r , &c , &x);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
topovi.cpp:68:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d%d%d" , &r1 , &c1 , &r2 , &c2);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...