QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#426130#8724. Septemberneilliu0 15ms16808kbC++142.4kb2024-05-30 21:19:222024-05-30 21:19:24

Judging History

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

  • [2024-05-30 21:19:24]
  • 评测
  • 测评结果:0
  • 用时:15ms
  • 内存:16808kb
  • [2024-05-30 21:19:22]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#include "september.h"
#define MAXN 100005
#define MAXM 6
int dep[MAXN];
vector<int> edge[MAXN];
int F[MAXN],S[MAXM][MAXN];
int sum[MAXM][MAXN];//xia mian you ji ge dian zai xu lie li
int status[MAXM][MAXN];//mu qian zhuang kuang
bool ok[MAXM][MAXN];
int nowin[MAXM][MAXN];
void dfs1(int now){//calcu dep
    dep[now] = 1;
    for(int i = 0; i < edge[now].size(); i++){
        if(edge[now][i] == F[now]) continue;
        dfs1(edge[now][i]);
        dep[now] += dep[edge[now][i]];
    }
}
int solve(int n,int m,vector<int> f,vector< vector<int> > s){
    for(int i = 1; i < n; i++) F[i] = f[i-1];
    for(int i = 0; i < m; i++){
        for(int j = 0; j < n; j++) S[i][j] = s[i][j];
    }
    memset(dep,0,sizeof(dep));
    memset(sum,0,sizeof(sum));
    memset(status,0,sizeof(status));
    memset(ok,0,sizeof(ok));
    memset(nowin,0,sizeof(nowin));
    for(int i = 0; i < n; i++) edge[i].clear();
    for(int i = 1; i < n; i++){
        edge[i].push_back(F[i]);
        edge[F[i]].push_back(i); 
    }
	dfs1(0);
    //for(int i = 1; i < n; i++) cout << dep[i] << " ";
    for(int i = 0; i < n-1; i++){//mei ju di i tian
        for(int j = 0; j < m; j++){
            int dian = S[j][i];
            while(1){
            	if(dian == 0) break;
                if(status[j][dian] == 0 && dian == S[j][i]) status[j][dian] = -1,status[j][n]--,sum[j][dian]++;
                if(sum[j][dian] == dep[dian]){
                    status[j][n] += (1 - status[j][dian]);
                    status[j][dian] = 1;
                    sum[j][F[dian]] += sum[j][dian];
                    dian = F[dian];
                }else break;
            }
            if(status[j][n] == i+1) ok[j][i] = 1;
            else ok[j][i] = 0;
        }
    }
    int ans = 0;
    for(int i = 0; i < n-1; i++){
        for(int j = 0; j < m; j++){
            //cout << status[j][i] << " " << ok[j][i] << endl;
            nowin[j][S[j][i]] = 1;
        }
        bool ok1 = 1;
        for(int j = 0; j < m; j++){
            int count = 0;
            for(int jj = 0; jj < m; jj++) count += nowin[jj][S[j][i]];
            if(count != m){
                ok1 = 0; break;
            }
        }
        if(ok1 == 0) continue;
        int count = 0;
        for(int j = 0; j < m; j++) if(ok[j][i] == 1) count++;
        if(count == m) ans++; 
    }
    return ans;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
4
7 1
0 0 2 3 3 5
1 6 4 3 5 2
10 1
0 1 2 0 3 0 5 4 8
9 7 6 8 4 5 3 2 1
7 1
0 0 0 1 3 0
2 4 1 6 5 3
6 1
0 0 1 1 3
4 5 2 3 1

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
0
2
2
0

result:

wrong answer 2nd lines differ - expected: '5', found: '0'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Wrong Answer

Test #17:

score: 0
Wrong Answer
time: 15ms
memory: 16808kb

input:

txy4h26c1rm1uv8tr3eonahd67u8h56x
53
10 1
0 1 2 3 4 5 6 7 8
9 8 7 6 5 4 3 2 1
10 1
0 1 2 3 4 5 6 7 8
9 7 8 5 6 4 3 2 1
10 1
0 1 2 3 4 5 6 7 8
8 9 7 5 6 3 2 4 1
10 1
0 1 2 3 4 5 6 7 8
8 9 6 7 5 4 3 2 1
10 1
0 1 2 3 4 5 6 7 8
8 9 7 5 6 3 4 2 1
10 1
0 1 2 3 4 5 6 7 8
9 8 7 6 5 4 2 3 1
10 1
0 1 2 3 4 5 6...

output:

7ckgnn4wyi495puj3ibqf81dqvapyv6b
0
0
1
1
1
0
0
0
1
0
0
1
0
1
0
1
1
0
0
1
0
0
0
0
1
1
1
1
0
0
0
1
1
0
1
0
0
0
1
0
1
1
0
1
0
1
0
1
0
0
0
0
1

result:

wrong answer 2nd lines differ - expected: '9', found: '0'

Subtask #4:

score: 0
Skipped

Dependency #1:

0%

Subtask #5:

score: 0
Skipped

Dependency #3:

0%

Subtask #6:

score: 0
Skipped

Dependency #1:

0%

Subtask #7:

score: 0
Skipped

Dependency #3:

0%

Subtask #8:

score: 0
Skipped

Dependency #1:

0%

Subtask #9:

score: 0
Skipped

Dependency #3:

0%

Subtask #10:

score: 0
Skipped

Dependency #1:

0%