| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 202319 | errorgorn | 자리 배치 (IOI18_seats) | C++14 | 4062 ms | 41224 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "seats.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;
int h,w;
ii pos[1000005];
void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) {
h=H,w=W;
for (int x=0;x<h*w;x++){
pos[x]=ii(R[x],C[x]);
}
//print();
}
int swap_seats(int a, int b) {
swap(pos[a],pos[b]);
//print();
int x1,x2,y1,y2;
x1=x2=pos[0].first;
y1=y2=pos[0].second;
int s=1;
int biggest=0;
int res=1;
for (int x=1;x<h*w;x++){
while (pos[x].first<x1){
x1--;
s+=y2-y1+1;
}
while (x2<pos[x].first){
x2++;
s+=y2-y1+1;
}
while (pos[x].second<y1){
y1--;
s+=x2-x1+1;
}
while (y2<pos[x].second){
y2++;
s+=x2-x1+1;
}
if (s==x+1) res++;
}
return res;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
