Submission #372975

#TimeUsernameProblemLanguageResultExecution timeMemory
372975MilosMilutinovicSeats (IOI18_seats)C++14
Compilation error
0 ms0 KiB
#include "seats.h" #include <bits/stdc++.h> using namespace std; const int N=10050; int x[N],y[N]; int swap_seats(int a,int b){ swap(x[a],x[b]); swap(y[a],y[b]); int row[2]={1e9,0},col[2]={1e9,0},ans=0; for(int i=0;i<H*W;i++){ ckmn(row[0],x[i]); ckmx(row[1],x[i]); ckmn(col[0],y[i]); ckmx(col[1],y[i]); int Area=(row[1]-row[0]+1)*(col[1]-col[0]+1); if(Area==i+1)ans++; } return ans; } void give_initial_chart(int H,int W,int* R,int* C){ for(int i=0;i<H*W;i++)x[i]=R[i],y[i]=C[i]; }

Compilation message (stderr)

seats.cpp: In function 'int swap_seats(int, int)':
seats.cpp:9:19: error: narrowing conversion of '1.0e+9' from 'double' to 'int' [-Wnarrowing]
    9 |  int row[2]={1e9,0},col[2]={1e9,0},ans=0;
      |                   ^
seats.cpp:9:34: error: narrowing conversion of '1.0e+9' from 'double' to 'int' [-Wnarrowing]
    9 |  int row[2]={1e9,0},col[2]={1e9,0},ans=0;
      |                                  ^
seats.cpp:10:16: error: 'H' was not declared in this scope
   10 |  for(int i=0;i<H*W;i++){
      |                ^
seats.cpp:10:18: error: 'W' was not declared in this scope
   10 |  for(int i=0;i<H*W;i++){
      |                  ^
seats.cpp:11:3: error: 'ckmn' was not declared in this scope
   11 |   ckmn(row[0],x[i]);
      |   ^~~~
seats.cpp:12:3: error: 'ckmx' was not declared in this scope
   12 |   ckmx(row[1],x[i]);
      |   ^~~~