Submission #736445

#TimeUsernameProblemLanguageResultExecution timeMemory
736445myrcellaSeats (IOI18_seats)C++17
11 / 100
1403 ms49772 KiB
//by szh #include<bits/stdc++.h> using namespace std; #define fi first #define se second #define pii pair<int,int> #define pll pair<long long,long long> #define pb push_back #define debug(x) cerr<<#x<<"="<<x<<endl #define pq priority_queue #define inf 0x3f #define rep(i,a,b) for (int i=a;i<(b);i++) #define MP make_pair #define SZ(x) (int(x.size())) #define ll long long #define mod 1000000007 #define ALL(x) x.begin(),x.end() void inc(int &a,int b) {a=(a+b)%mod;} void dec(int &a,int b) {a=(a-b+mod)%mod;} int lowbit(int x) {return x&(-x);} ll p0w(ll base,ll p) {ll ret=1;while(p>0){if (p%2ll==1ll) ret=ret*base%mod;base=base*base%mod;p/=2ll;}return ret;} namespace { int read_int() { int x; if (scanf("%d", &x) != 1) { fprintf(stderr, "Error while reading input\n"); exit(1); } return x; } } // namespace #include "seats.h" const int maxn = 1e4+10; pii pos[maxn]; int n; void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) { rep(i,0,H*W) pos[i] = {R[i],C[i]}; n = H*W; } int swap_seats(int a, int b) { swap(pos[a],pos[b]); int ret = 1; int minx = pos[0].fi, maxx = pos[0].fi, miny = pos[0].se, maxy = miny; rep(i,1,n) { minx = min(minx,pos[i].fi); maxx = max(maxx,pos[i].fi); miny = min(miny,pos[i].se); maxy = max(maxy,pos[i].se); if ((maxx-minx+1) * (maxy-miny+1) == i+1) ret++; } return ret; }

Compilation message (stderr)

seats.cpp:26:5: warning: 'int {anonymous}::read_int()' defined but not used [-Wunused-function]
   26 | int read_int() {
      |     ^~~~~~~~
#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...