Submission #125089

#TimeUsernameProblemLanguageResultExecution timeMemory
125089arthurconmySeats (IOI18_seats)C++14
11 / 100
4075 ms40216 KiB
#include <iostream> #include <fstream> #include <vector> #include <string> #include <cmath> #include <algorithm> #include <map> #include <queue> #include <bitset> #include <random> #include <stack> #include <deque> #include <chrono> #include "seats.h" using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vll; typedef vector<bool> vb; typedef pair<int,int> pii; #define REP(i, a, b) for (int i = int(a); i <= int(b); i++) #define REPb(j, d, c) for (int j = int(d); j >= int(c); j--) #define ff first #define ss second #define pb push_back #define len(x) int((x).size()) int h,w; vi R,C; void give_initial_chart(int H, int W, vi r, vi c) { h=H; w=W; R=r; C=c; } int swap_seats(int a, int b) { // R[i], C[i] are the coordinates of the ith person int oldra=R[a]; int oldca=C[a]; R[a]=R[b]; C[a]=C[b]; R[b]=oldra; C[b]=oldca; //cout<<"outchea"<<endl; int minr=R[0]; int maxr=R[0]; int minc=C[0]; int maxc=C[0]; int beauty=1; //cout << C[0] << " " << C[1] << " " << C[2] << endl; REP(i,1,h*w-1) { minr=min(minr,R[i]); maxr=max(maxr,R[i]); minc=min(minc,C[i]); maxc=max(maxc,C[i]); //cout << i << " " << maxr << " " << minr << " " << maxc << " " << minc << endl; if((maxr-minr+1)*(maxc-minc+1) == i+1) beauty++; } return beauty; } /*int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ifstream cin("input.txt"); //ifstream cin("test.in"); //ofstream cout("test.out"); }*/
#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...