답안 #154166

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
154166 2019-09-18T17:00:52 Z SeekingOblivion Relativnost (COCI15_relativnost) C++14
0 / 140
4000 ms 58952 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 Incorrect 2 ms 376 KB Output isn't correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Execution timed out 4014 ms 50288 KB Time limit exceeded
5 Execution timed out 4032 ms 58924 KB Time limit exceeded
6 Execution timed out 4014 ms 54916 KB Time limit exceeded
7 Execution timed out 4024 ms 53756 KB Time limit exceeded
8 Runtime error 1634 ms 33480 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
9 Execution timed out 4027 ms 58952 KB Time limit exceeded
10 Execution timed out 4014 ms 56840 KB Time limit exceeded