제출 #125224

#제출 시각아이디문제언어결과실행 시간메모리
125224chubyxdxd자리 배치 (IOI18_seats)C++11
11 / 100
4050 ms41372 KiB
#include "seats.h" #include <bits/stdc++.h> using namespace std; #define pb push_back std::vector<int> r; std::vector<int> c; typedef pair<int,int> ii; vector<int> vmaxx; vector<int> vmaxy; vector<int> vminy; vector<int> vminx; int g=0,e,d; void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) { r = R; c = C; int maxx=r[0],minx=r[0],maxy=c[0],miny=c[0]; for(int i=0;i<H*W;i++){ int x1,y1; x1=r[i]; y1=c[i]; maxx=max(maxx,x1); minx=min(minx,x1); maxy=max(maxy,y1); miny=min(miny,y1); d=abs(maxx-minx)+1; e=abs(maxy-miny)+1; if(d*e==i+1){ g++; } vmaxx.pb(maxx); vmaxy.pb(maxy); vminx.pb(minx); vminy.pb(miny); } /*for(int i=0;i<H*W;i++){ cout<<vmaxx[i]<<" "<<vminx[i]<<" "<<vmaxy[i]<<" "<<vminy[i]<<endl; }*/ //cout<<g<<endl; } int swap_seats(int a, int b) { int x1,y1; //int x2,y2; swap(r[a],r[b]); swap(c[a],c[b]); //int maxx=r[0],minx=r[0],maxy=c[0],miny=c[0]; if(abs(a-b)<=10000){ int j=min(a,b); int k=max(a,b); for(int i=j;i<=k;i++){ d=abs(vmaxx[i]-vminx[i])+1; e=abs(vmaxy[i]-vminy[i])+1; if(e*d==i+1){ g--; } } int maxx=r[0],minx=r[0],maxy=c[0],miny=c[0]; int tam=vmaxx.size(); for(int i=0;i<tam;i++){ maxx=max(r[i],maxx); minx=min(r[i],minx); maxy=max(c[i],maxy); miny=min(c[i],miny); vmaxx[i]=maxx; vmaxy[i]=maxy; vminx[i]=minx; vminy[i]=miny; } for(int i=j;i<=k;i++){ d=abs(vmaxx[i]-vminx[i])+1; e=abs(vmaxy[i]-vminy[i])+1; if(e*d==i+1){ g++; } } return g; } }

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

seats.cpp: In function 'int swap_seats(int, int)':
seats.cpp:41:7: warning: unused variable 'x1' [-Wunused-variable]
   int x1,y1;
       ^~
seats.cpp:41:10: warning: unused variable 'y1' [-Wunused-variable]
   int x1,y1;
          ^~
seats.cpp:77:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...