QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#378536#8566. Can We Still Qualify For Semifinals?ucup_team_qiuly#WA 1ms3764kbC++141.4kb2024-04-06 13:28:552024-04-06 13:28:57

Judging History

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

  • [2024-04-06 13:28:57]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3764kb
  • [2024-04-06 13:28:55]
  • 提交

answer

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int a[15];
int tot,qwq[50][2];
int val[15];
int main(){
    for (int i=1;i<=10;i++)a[i]=i;
    for (int i=1;i<=9;i++){
        for (int l=1,r=10;l<r;l++,r--)qwq[tot][0]=a[l]-1,qwq[tot][1]=a[r]-1,tot++;
        int v=a[10];
        for (int j=10;j>=3;j--)a[j]=a[j-1];
        a[2]=v;
    }
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        string str;
        cin>>str;
        memset(val,0,sizeof(val));
        for (int i=0;i<n;i++){
            if (str[i]=='1')val[qwq[i][0]]++;
            else val[qwq[i][1]]++;
        }
        int fg=0;
        for (int i=0;i<1024;i++){
            if (__builtin_popcount(i)>3)continue;
            int _val[15];
            for (int j=0;j<10;j++)_val[j]=val[j];
            for (int j=n;j<45;j++){
                int x=qwq[j][0],y=qwq[j][1];
                if (((i>>x)&1))_val[x]++;
                else if ((i>>y)&1)_val[y]++;
                else if (_val[x]<val[y])_val[x]++;
                else _val[y]++;
            }
            int s=1;
            for (int j=0;j<10;j++)
                if (!((i>>j)&1)){
                    if (_val[j]>_val[0])s=0;
                }
            if (s==1)fg=1;
        }
        if (fg==1)puts("YES");
        else puts("NO");
    }
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3524kb

input:

3
3
111
25
1000010101111111111010100
35
01111011110111101111011110111101111

output:

YES
YES
NO

result:

ok 3 token(s): yes count is 2, no count is 1

Test #2:

score: 0
Accepted
time: 1ms
memory: 3544kb

input:

10
16
0110000001010100
17
01111000110110101
15
001100010101111
16
0010101010011100
19
0000000100010110100
16
0011101010011100
18
011110010001100000
18
000110101001100011
20
01100010000100100100
15
001000111001101

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES

result:

ok 10 token(s): yes count is 10, no count is 0

Test #3:

score: 0
Accepted
time: 0ms
memory: 3560kb

input:

10
37
0110000001010100011101001011100110001
39
000100111101101001100101101000000000100
35
00111000100111100101011010111100100
33
010000010001110010110001101110001
30
000100010100000010010110101010
31
0000101000011010101001010000000
44
00001000000111101011010110000101100011000100
42
01111011110001001...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO

result:

ok 10 token(s): yes count is 0, no count is 10

Test #4:

score: -100
Wrong Answer
time: 1ms
memory: 3764kb

input:

10
23
01100000010101000111010
38
01111001100011000101011110101001101001
27
010000000001001001110001001
26
01101001110011101101000110
8
00001000
22
0110100110001110110001
9
000100010
24
000000100101101010100100
6
011000
29
01101010100101000000000000100

output:

NO
NO
NO
NO
YES
NO
YES
YES
YES
NO

result:

wrong answer expected YES, found NO [1st token]