| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1340062 | akqxolotl | 자리 배치 (IOI18_seats) | C++20 | 4094 ms | 24120 KiB |
#include "seats.h"
//Segment Tree is a State of Mind
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr<<#x<<" is "<<x<<endl;
#define debugp(x,y) cerr<<#x<<' '<<#y<<" is "<<x<<' '<<y<<endl;
#define debugl(x) cerr<<#x<<" is ";for(auto p:x)cerr<<p<<" ";cerr<<endl;
#define debugpl(x) cerr<<#x<<" is ";for(auto p:x)cerr<<p.first<<" "<<p.second<<" , ";cerr<<endl;
//#define int long long
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<int,pii> ipii;
#define pb push_back
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define rdint(x,y) rnd()%(y-x+1)+x
const int inf=4e18+5;
const int mod=1e9+7;
const int mod2=998244353;
const int mod3=1e9+9;
const int maxn=1e6+5;
pii s[maxn];
int n;
void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) {
for(int i=0;i<H*W;i++){
s[i]={R[i],C[i]};
}
n=H*W;
}
int swap_seats(int a, int b) {
pii t=s[a];
s[a]=s[b];
s[b]=t;
int sx=INT_MAX,sy=INT_MAX,ex=0,ey=0;
int ans=0;
for(int i=0;i<n;i++){
sy=min(sy,s[i].fi);
sx=min(sx,s[i].se);
ey=max(ey,s[i].fi);
ex=max(ex,s[i].se);
if(i+1==(ey-sy+1)*(ex-sx+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... | ||||
