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>
#include "aliens.h"
//#include "grader.cpp"
using namespace std;
typedef long long ll;
const int MX=109;
int v[MX];
bool vis[MX][MX];
void add(int x,int y,int x2,int y2){
for(int i=x;i<=x2;i++)for(int j=y;j<=y2;j++)vis[i][j]=1;
}
ll take_photos(int n, int m, int k, vector<int> r, vector<int> c) {
for(int i=0;i<m;i++)v[i]=-1;
for(int i=0;i<n;i++){
if(r[i] < c[i])swap(r[i],c[i]);
v[r[i]]=max(v[r[i]],c[i]);
}
for(int i=0;i<m;i++){
if(v[i] == -1)continue;
if(vis[i][v[i]])continue;
// cout<<i<<" "<<v[i]<<endl;
int mn=min(v[i],i);
int mx=max(v[i],i);
add(mn,mn,mx,mx);
}
int ans=0;
for(int i=0;i<m;i++)for(int j=0;j<m;j++)ans+=vis[i][j];
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... |