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 "seats.h"
#include<bits/stdc++.h>
using namespace std;
std::vector<int> r;
std::vector<int> c;
vector<vector<int> > grid;
int h;
int w;
void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) {
r = R;
c = C;
h = H;
w = W;
grid.resize(H,vector<int>(W));
for(int i=0;i<H*W;i++)
{
grid[r[i]][c[i]]=i;
}
}
int swap_seats(int a, int b) {
swap(r[a], r[b]);
swap(c[a], c[b]);
grid[r[a]][c[a]]=a;
grid[r[b]][c[b]]=b;
int ans=0;
for(int hi=0;hi<=r[0];hi++)
{
for(int hj=r[0];hj<h;hj++)
{
for(int ci=0;ci<=c[0];ci++)
{
for(int cj=c[0];cj<h;cj++)
{
bool chek=true;
for(int i=hi;i<=hj;i++)
{
for(int j=ci;j<=cj;j++)
{
if(grid[i][j]>((cj-ci+1)*(hj-hi+1)))
{
chek=false;
}
}
}
if(chek==true) ans++;
}
}
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |