Submission #348295

#TimeUsernameProblemLanguageResultExecution timeMemory
348295beksultan04Seats (IOI18_seats)C++14
0 / 100
328 ms37264 KiB
#include "seats.h" //#include "grader.cpp" #include <bits/stdc++.h> using namespace std; #define lol long long #define pii pair<int,int> #define OK puts("OK"); #define NO puts("NO"); #define YES puts("YES"); #define fr first #define sc second #define ret return #define scanl(a) scanf("%lld",&a); #define scanll(a,b) scanf("%lld %lld",&a, &b); #define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c); #define scan1(a) scanf("%d",&a); #define scan2(a,b) scanf("%d %d",&a, &b); #define scan3(a,b,c) scanf("%d %d %d",&a,&b,&c); #define all(s) s.begin(),s.end() #define allr(s) s.rbegin()Ñ,s.rend() #define pb push_back #define sz(v) (int)v.size() #define endi puts(""); #define eps 1e-12 const int N = 3e5+12,INF=1e9+7; pii p[N]; int n,ans[N]; void give_initial_chart(int H, int W, vector<int> R, vector<int> C) { int i; n = H*W; for (i=0;i<n;++i) p[i] = {R[i],C[i]}; int x1=INF,y1=INF,x2=0,y2=0; for (i=0;i<n;++i){ x1 = min(x1,p[i].fr); y1 = min(y1,p[i].sc); x2 = max(x2,p[i].fr); y2 = max(y2,p[i].sc); int x = x2-x1+1; int y = y2-y1+1; int z = x*y-1,cc =0; if (z == i){ cc ++; } ans[i] = cc+ans[i-1]; } } int swap_seats(int a, int b) { swap(p[a],p[b]); int x1=INF,y1=INF,x2=0,y2=0,i; for (i=a;i<n;++i){ x1 = min(x1,p[i].fr); y1 = min(y1,p[i].sc); x2 = max(x2,p[i].fr); y2 = max(y2,p[i].sc); int x = x2-x1+1; int y = y2-y1+1; int z = x*y-1,cc =0; if (z == i){ cc ++; } ans[i] = ans[i-1]+cc; } return ans[n-1]; }
#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...