# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
284094 | peti1234 | Seats (IOI18_seats) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int c=1000002;
int n, m, sor[c], oszlop[c];
int swap_seats(int a, int b) {
swap(sor[a], sor[b]), swap(oszlop[a], oszlop[b]);
int db=0, ks=n, ns=0, ko=n, no=0;
for (int i=0; i<n*m; i++) {
ks=min(ks, sor[i]), ko=min(ko, oszlop[i]);
ns=max(ns, sor[i]), no=max(no, oszlop[i]);
if ((ns-ks+1)*(no-ko+1)==i+1) db++;
}
return db;
}
give_initial_chart(int a, int b, vector<int> c, vector<int> d) {
n=a, m=b;
for (int i=0; i<n*m; i++) sor[i]=c[i], oszlop[i]=d[i];
}