Submission #152684

#TimeUsernameProblemLanguageResultExecution timeMemory
152684Segtree자리 배치 (IOI18_seats)C++14
Compilation error
0 ms0 KiB
#include<iostream> #include<algorithm> #include<vector> #include<set> using namespace std; typedef long long ll; #define mod 1000000007 #define N 10010 #define chmin(a,b) a=min(a,b) #define chmax(a,b) a=max(a,b) ll h,w,r[N],c[N]; void give_initial_chart(int H,int W,int[] R, int[] C){ h=H,w=W; for(int i=1;i<=h*w;i++)r[i]=R[i]; for(int i=1;i<=h*w;i++)c[i]=C[i]; } int swap_seats(int a,int b){ if(h*w>N)return 0; swap(r[a],r[b]); swap(c[a],c[b]); ll xl=1e17,xr=-1e17,yl=1e17,yr=-1e17; ll ans=0; for(int k=1;k<=h*w;k++){ chmin(xl,r[k]); chmax(xr,r[k]); chmin(yl,c[k]); chmax(yr,c[k]); if((xr-xl+1)*(yr-yl+1)==k)ans++; } return ans; }/* int main(){ return 0; }*/

Compilation message (stderr)

seats.cpp:12:43: error: expected ',' or '...' before 'R'
 void give_initial_chart(int H,int W,int[] R, int[] C){
                                           ^
seats.cpp: In function 'void give_initial_chart(int, int, int*)':
seats.cpp:14:33: error: 'R' was not declared in this scope
     for(int i=1;i<=h*w;i++)r[i]=R[i];
                                 ^
seats.cpp:15:33: error: 'C' was not declared in this scope
     for(int i=1;i<=h*w;i++)c[i]=C[i];
                                 ^