제출 #152682

#제출 시각아이디문제언어결과실행 시간메모리
152682Segtree자리 배치 (IOI18_seats)C++14
컴파일 에러
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]; 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; }

컴파일 시 표준 에러 (stderr) 메시지

seats.cpp:12:38: error: expected ',' or '...' before 'R'
 give_initial_chart(int H,int W,int[] R, int[] C){
                                      ^
seats.cpp:12:48: error: ISO C++ forbids declaration of 'give_initial_chart' with no type [-fpermissive]
 give_initial_chart(int H,int W,int[] R, int[] C){
                                                ^
seats.cpp: In function 'int 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];
                                 ^
seats.cpp:16:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^