QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#378607 | #8566. Can We Still Qualify For Semifinals? | ucup_team_qiuly# | WA | 408ms | 3760kb | C++14 | 1.2kb | 2024-04-06 13:44:38 | 2024-04-06 13:44:40 |
Judging History
answer
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int a[15];
int tot,qwq[50][2];
int val[15];
int fg;
bool check(){
int cnt=0;
for (int i=1;i<10;i++)
if (val[i]>val[0])cnt++;
if (cnt>3)return 0;
return 1;
}
void dfs(int x){
if (x==45){
if (check())fg=1;
return;
}
if (qwq[x][0]==0||qwq[x][1]==0)val[0]++,dfs(x+1);
else val[qwq[x][0]]++,dfs(x+1),val[qwq[x][0]]--,val[qwq[x][1]]++,dfs(x+1);
return;
}
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]]++;
}
if (n<=15){
puts("YES");
continue;
}
fg=0;
dfs(n);
if (fg==1)puts("YES");
else puts("NO");
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3528kb
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: 408ms
memory: 3560kb
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: -100
Wrong Answer
time: 1ms
memory: 3760kb
input:
10 37 0110000001010100011101001011100110001 39 000100111101101001100101101000000000100 35 00111000100111100101011010111100100 33 010000010001110010110001101110001 30 000100010100000010010110101010 31 0000101000011010101001010000000 44 00001000000111101011010110000101100011000100 42 01111011110001001...
output:
NO NO NO NO YES NO NO NO NO NO
result:
wrong answer expected NO, found YES [5th token]