QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#521914#7120. Soccerkimmoqt#1.5 288ms305164kbC++202.3kb2024-08-16 16:39:302024-08-16 16:39:30

Judging History

你现在查看的是最新测评结果

  • [2024-08-16 16:39:30]
  • 评测
  • 测评结果:1.5
  • 用时:288ms
  • 内存:305164kb
  • [2024-08-16 16:39:30]
  • 提交

answer

#include "soccer.h"
#include <bits/stdc++.h>
using namespace std;

const int MX=2005;
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

vector<vector<int>> F;
int N;
bool vis[MX][MX];

void dfs(int x, int y) {
        vis[x][y]=true;
        for(int k=0;k<4;k++) {
                int nx=x+dx[k],ny=y+dy[k];
                if(nx>=0 && nx<N && ny>=0 && ny<N && !vis[nx][ny] && !F[nx][ny]) {
                        dfs(nx,ny);
                }
        }
}

vector<int> v[MX],vv[MX];

int biggest_stadium(int N, std::vector<std::vector<int>> F) {
        ::N=N, ::F=F;

        int cnt=0;
        for(int i=0;i<N;i++) {
                for(int j=0;j<N;j++) {
                        if(F[i][j] || vis[i][j]) continue;
                        dfs(i,j);
                        cnt++;
                }
        }

        if(cnt>1) return 0;

        for(int i=0;i<N;i++) {
                for(int j=0;j<N;j++) {
                        if(F[i][j]) continue;
                        int k=j;
                        while(k+1<N && F[i][k+1]==0) k++;
                        v[i].push_back(j);
                        v[i].push_back(k);
                        j=k;
                }

                if(v[i].size()>2) return 0;
        }

        for(int j=0;j<N;j++) {
                for(int i=0;i<N;i++) {
                        if(F[i][j]) continue;
                        int k=i;
                        while(k+1<N && F[k+1][j]==0) k++;
                        vv[j].push_back(i);
                        vv[j].push_back(k);
                        i=k;
                }

                if(vv[j].size()>2) return 0;
        }

        cnt=0;
        for(int i=1;i+1<N;i++) {
                if(v[i].empty() || v[i-1].empty() || v[i+1].empty()) continue;
                if(v[i-1][0]>v[i][0] && v[i][1]<v[i+1][0]) cnt++;
        }
        if(cnt>0) return 0;

        cnt=0;
        for(int j=1;j+1<N;j++) {
                if(vv[j].empty() || vv[j-1].empty() || vv[j+1].empty()) continue;
                if(vv[j-1][0]>vv[j][0] && vv[j][1]<vv[j+1][1]) cnt++;
        }
        if(cnt>0) return 0;

        int ans=0;
        for(int i=0;i<N;i++) {
                for(int j=0;j<N;j++) {
                        ans+=!F[i][j];
                }
        }

        return ans;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 1.5
Acceptable Answer

Test #1:

score: 6
Accepted
time: 0ms
memory: 3864kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
1
0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
1

result:

ok ok

Test #2:

score: 1.5
Acceptable Answer
time: 0ms
memory: 3836kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 0
0 1 0
0 0 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
0

result:

points 0.250 partial

Test #3:

score: 1.5
Acceptable Answer
time: 1ms
memory: 5068kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
100
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
0

result:

points 0.250 partial

Test #4:

score: 1.5
Acceptable Answer
time: 11ms
memory: 23720kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
500
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
0

result:

points 0.250 partial

Test #5:

score: 1.5
Acceptable Answer
time: 288ms
memory: 305164kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
2000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
0

result:

points 0.250 partial

Test #6:

score: 6
Accepted
time: 0ms
memory: 3844kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
9
1 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
80

result:

ok ok

Test #7:

score: 6
Accepted
time: 0ms
memory: 3800kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
10
0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
99

result:

ok ok

Test #8:

score: 6
Accepted
time: 0ms
memory: 4132kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 0
0 0 0
0 0 1

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
8

result:

ok ok

Test #9:

score: 6
Accepted
time: 0ms
memory: 3868kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 0
0 0 0
1 0 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
8

result:

ok ok

Subtask #2:

score: 0
Wrong Answer

Test #10:

score: 2
Acceptable Answer
time: 0ms
memory: 3920kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 0
0 1 0
0 1 1

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
0

result:

points 0.250 partial

Test #11:

score: 2
Acceptable Answer
time: 0ms
memory: 4132kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 0
0 1 1
0 0 1

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
0

result:

points 0.250 partial

Test #12:

score: 0
Wrong Answer
time: 0ms
memory: 3844kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 1
0 0 0
1 1 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
6

result:

wrong answer wrong

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 0
Skipped

Dependency #1:

25%
Acceptable Answer

Dependency #2:

0%