# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
134765 | Boxworld | Seats (IOI18_seats) | C++14 | 4082 ms | 40868 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;
const int maxN=1000100;
struct node{int x,y;}p[maxN];
int h,w;
void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) {
h=H;w=W;
for (int i=0;i<H*W;i++){
p[i].x=R[i];p[i].y=C[i];
}
}
int swap_seats(int a, int b){
int t=a,ans=0;
swap(p[a],p[b]);
int Hi=p[0].x,Hx=p[0].x,Wi=p[0].y,Wx=p[0].y;
for (int i=0;i<h*w;i++){
if (p[i].x<Hi)Hi=p[i].x;
if (p[i].x>Hx)Hx=p[i].x;
if (p[i].y<Wi)Wi=p[i].y;
if (p[i].y>Wx)Wx=p[i].y;
if ((Hx-Hi+1)*(Wx-Wi+1)==i+1)ans++;
}
return ans;
}
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... |