| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 153933 | Ruxandra985 | Topovi (COCI15_topovi) | C++14 | 1750 ms | 33400 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
#include <set>
#include <map>
#include <algorithm>
using namespace std;
map <int,int> line,col,fl,fc;
map <pair <int,int> , int > mp;
long long sol = 0;
int n;
void add (int r , int c , int x){
sol = sol - (n - fc[line[r]]);
sol = sol - (n - fl[col[c]]);
if (line[r] == col[c])
sol++;
fl[line[r]]--;
fc[col[c]]--;
line[r] = (line[r] ^ x);
col[c] = (col[c] ^ x);
/// n - cate col au val line[r]
fl[line[r]]++;
fc[col[c]]++;
sol = sol + n - fc[line[r]];
sol = sol + n - fl[col[c]];
if (line[r] == col[c])
sol--;
}
int main()
{
FILE *fin = stdin;
FILE *fout = stdout;
int k,p,r,x,i,a,b,c,d;
fscanf (fin,"%d%d%d",&n,&k,&p);
fc[0] = fl[0] = n;
for (i=1;i<=k;i++){
fscanf (fin,"%d%d%d",&r,&c,&x);
mp[make_pair(r,c)] = x;
add(r,c,x);
}
for (i=1;i<=p;i++){
fscanf (fin,"%d%d%d%d",&a,&b,&c,&d);
x = mp[make_pair(a,b)];
mp.erase(make_pair(a,b));
add(a,b,x);
add(c,d,x);
mp[make_pair(c,d)] = x;
fprintf (fout,"%lld\n",sol);
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
