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 "aliens.h"
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
const int maxn=105;
int n, m, k;
bool bio[maxn][maxn];
void dfs(int x, int y){
if(bio[x][y]){
return;
}
bio[x][y]=1;
if(x==y){
return;
}
dfs(x+1, y);
dfs(x, y-1);
}
void dfs2(int x, int y){
if(bio[x][y]){
return;
}
bio[x][y]=1;
if(x==y){
return;
}
dfs(x-1, y);
dfs(x, y+1);
}
ll take_photos(int nn, int mm, int kk, vector < int > r, vector < int > c){
n=nn;
m=mm;
k=kk;
for(int i=0; i<n; i++){
dfs(min(r[i], c[i]), max(r[i], c[i]));
dfs2(max(r[i], c[i]), min(r[i], c[i]));
}
int pov=0;
for(int i=0; i<m; i++){
for(int j=0; j<m; j++){
if(bio[i][j]){
pov++;
}
}
}
return pov;
}
# | 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... |