Submission #134765

#TimeUsernameProblemLanguageResultExecution timeMemory
134765BoxworldSeats (IOI18_seats)C++14
11 / 100
4082 ms40868 KiB
#include "seats.h" #include <bits/stdc++.h> using namespace std; const int maxN=1000100; struct node{int x,y;}p[maxN]; int h,w; void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) { h=H;w=W; for (int i=0;i<H*W;i++){ p[i].x=R[i];p[i].y=C[i]; } } int swap_seats(int a, int b){ int t=a,ans=0; swap(p[a],p[b]); int Hi=p[0].x,Hx=p[0].x,Wi=p[0].y,Wx=p[0].y; for (int i=0;i<h*w;i++){ if (p[i].x<Hi)Hi=p[i].x; if (p[i].x>Hx)Hx=p[i].x; if (p[i].y<Wi)Wi=p[i].y; if (p[i].y>Wx)Wx=p[i].y; if ((Hx-Hi+1)*(Wx-Wi+1)==i+1)ans++; } return ans; }

Compilation message (stderr)

seats.cpp: In function 'int swap_seats(int, int)':
seats.cpp:15:6: warning: unused variable 't' [-Wunused-variable]
  int t=a,ans=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...