Submission #82530

#TimeUsernameProblemLanguageResultExecution timeMemory
82530farukkastamonudaSeats (IOI18_seats)C++14
0 / 100
361 ms32928 KiB
#include "seats.h" #include <bits/stdc++.h> #define fi first #define se second #define lo long long #define inf 1000000009 #define md 1000000007 #define li 200005 #define mp make_pair #define pb push_back #define mid (start+end)/2 using namespace std; int A[105][105],n,m; pair<int,int> konum[10005]; vector<int> rg,cg; void give_initial_chart(int H,int W,vector<int> R,vector<int> C){ n=H; m=W; for(int i=0;i<H*W;i++){ int sat=R[i]; int sut=C[i]; A[sat][sut]=i; konum[i]=mp(sat,sut); } //~ for(int i=0;i<n;i++){ //~ for(int j=0;j<m;j++){ //~ printf("%d ",A[i][j]); //~ } //~ printf("\n"); //~ } } int swap_seats(int a,int b){ int cev=0; int sat1=konum[a].fi,sut1=konum[a].se; int sat2=konum[b].fi,sut2=konum[b].se; int temp=A[sat1][sut1]; konum[temp]=mp(sat2,sut2); konum[b]=mp(sat1,sut1); A[sat1][sut1]=A[sat2][sut2]; A[sat2][sut2]=temp; //~ for(int i=0;i<n;i++){ //~ for(int j=0;j<m;j++){ //~ printf("%d ",A[i][j]); //~ } //~ printf("\n"); //~ } int sifs=konum[0].fi,sifsu=konum[0].se; //cout<<"debug- > :: :: >> :: "<<sifs<<' '<<sifsu<<endl; for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ int mx=(abs(i-sifs)+1)*(abs(j-sifsu)+1)-1; int flag=0; for(int k=min(i,sifs);k<=max(sifs,i);k++){ for(int t=min(j,sifsu);t<=max(j,sifsu);t++){ if(A[k][t]>mx){ flag=1; break; } } if(flag==1) break; } if(flag==0) cev++; } } return cev; } //~ int main(){ //~ rg.pb(0),rg.pb(1),rg.pb(1),rg.pb(0),rg.pb(0),rg.pb(1); //~ cg.pb(0),cg.pb(0),cg.pb(1),cg.pb(1),cg.pb(2),cg.pb(2); //~ give_initial_chart(2,3,rg,cg); //~ int ty=swap_seats(0,5); //~ ty=swap_seats(0,5); //~ printf("%d\n",ty); //~ return 0; //~ }
#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...