답안 #154275

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
154275 2019-09-20T04:36:52 Z SeekingOblivion Topovi (COCI15_topovi) C++14
60 / 120
2000 ms 39160 KB
#include<fstream>
#include<map>
#include<iostream>
#define fin cin
#define fout cout
using namespace std;
//ifstream fin("date.in");
//ofstream fout("date.out");
int i,j,n,k,p,s;
long long sol;
map<int,int> xori,xorj,fi,fj;
map<pair<int,int>,int> r;
 
void solve(int i,int j,int p)
{
    if(xori.find(i)==xori.end()) xori[i]=0;
    if(xorj.find(j)==xorj.end()) xorj[j]=0;
    sol-=n-fj[xori[i]];
    sol-=n-fi[xorj[j]];
    fi[xori[i]]--;xori[i]^=p;fi[xori[i]]++;
    fj[xorj[j]]--;xorj[j]^=p;fj[xorj[j]]++;
    sol+=n-fj[xori[i]];
    sol+=n-fi[xorj[j]];
    r[make_pair(i,j)]^=p;
}
 
int main()
{
    fin>>n>>k>>p;
    fi[0]=fj[0]=n;
    for(;k--;)
    {
        fin>>i>>j>>s;
        solve(i,j,s);
    }
    for(;p--;)
    {
        fin>>i>>j;
        s=r[make_pair(i,j)];
        solve(i,j,s);
        fin>>i>>j;
        solve(i,j,s);
        fout<<sol<<"\n";
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 280 ms 6168 KB Output is correct
7 Correct 217 ms 5368 KB Output is correct
8 Correct 174 ms 4460 KB Output is correct
9 Correct 183 ms 4536 KB Output is correct
10 Correct 203 ms 4880 KB Output is correct
11 Execution timed out 2021 ms 37484 KB Time limit exceeded
12 Execution timed out 2037 ms 37336 KB Time limit exceeded
13 Execution timed out 2062 ms 38088 KB Time limit exceeded
14 Execution timed out 2031 ms 35428 KB Time limit exceeded
15 Execution timed out 2090 ms 38084 KB Time limit exceeded
16 Execution timed out 2055 ms 36732 KB Time limit exceeded
17 Execution timed out 2071 ms 39160 KB Time limit exceeded
18 Execution timed out 2036 ms 37972 KB Time limit exceeded
19 Execution timed out 2035 ms 38120 KB Time limit exceeded
20 Execution timed out 2037 ms 37264 KB Time limit exceeded