Submission #348292

#TimeUsernameProblemLanguageResultExecution timeMemory
348292beksultan04Seats (IOI18_seats)C++14
11 / 100
1712 ms37996 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; 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 swap_seats(int a, int b) { swap(p[a],p[b]); int x1=INF,y1=INF,x2=0,y2=0,i,ans=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; if (z == i){ ans ++; } } return ans; }
#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...