Submission #605316

#TimeUsernameProblemLanguageResultExecution timeMemory
605316AmirElarbiSeats (IOI18_seats)C++14
11 / 100
4045 ms40748 KiB
#include <bits/stdc++.h> #define vi vector<int> #define ve vector #define ll long long #define vf vector<float> #define vll vector<pair<ll,ll>> #define ii pair<int,int> #define pll pair<ll,ll> #define vvi vector<vi> #define vii vector<ii> #define gii greater<ii> #define pb push_back #define mp make_pair #define fi first #define se second #define INF 2e9+5 #define eps 1e-7 #define eps1 1e-25 #define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define MAX_A 1e5+5 #define V 450 using namespace std; const int MOD = 1e9; const int nax = 1e5+5; //#include "seats.h" vi r,c; int w,h; void give_initial_chart(int H, int W, vi R, vi C) { r = R; c = C; w = W; h = H; } int swap_seats(int a, int b) { int mnr = INF, mnc = INF, mxc = 0, mxr = 0, res = 0; swap(r[a], r[b]); swap(c[a], c[b]); for (int i = 0; i < w*h; ++i) { mnr = min(mnr, r[i]); mxr = max(mxr, r[i]); mnc = min(mnc, c[i]); mxc = max(mxc, c[i]); if( (mxr-mnr+1) * (mxc-mnc+1) == i+1) { res++; } } return res; }
#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...