QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#388116#8566. Can We Still Qualify For Semifinals?BUET_POTATOES#WA 0ms3884kbC++201.8kb2024-04-13 12:16:122024-04-13 12:16:13

Judging History

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

  • [2024-04-13 12:16:13]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3884kb
  • [2024-04-13 12:16:12]
  • 提交

answer

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

typedef pair<int,int> pii;
vector<pii>matches;


void testcase(int cs){
    int k;
    cin>>k;
    string s;
    cin>>s;


//    for(auto [u,v] : matches){
//        cout<<u<<" - "<<v<<endl;
//    }
    int n = 10;
    vector<int>wins(10);
    for(int i=0; i<k; i++){
        if(s[i]=='1') wins[ matches[i].first ]++;
    }
    vector<pii>shob(n-1);
    for(int i=k; i<matches.size(); i++){
        if(matches[i].first==0) wins[0]++;
    }
    for(int i=1; i<n; i++) shob.emplace_back(wins[i], i);
    sort(shob.rbegin(), shob.rend());
    vector<bool>winer(n);
    winer[shob[0].second]=true;
    winer[shob[1].second]=true;
    winer[shob[2].second]=true;

    for(int i=k; i<matches.size(); i++){
        if(matches[i].first!=0){
            auto [u,v] = matches[i];
            if(winer[u]) wins[u]++;
            else if(winer[v]) wins[v]++;
            else{
                if(wins[u]<wins[v]) swap(u,v);
                wins[v]++;
            }
        }
    }
    int bigar = 0;
    for(int i=1; i<n; i++) if(wins[i]>wins[0]) bigar++;
    if(bigar>=4) cout<<"NO\n";
    else cout<<"YES\n";
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    vector<int>teams;
    for(int i=1; i<=10; i++) teams.push_back(i-1);
    for(int i=1; i<=9; i++){
        for(int j=0, k=teams.size()-1; j<k; j++, k--){
            matches.emplace_back(teams[j], teams[k]);
        }
        deque<int>tmp;
        for(int j=1; j<teams.size(); j++) tmp.push_back(teams[j]);
        int x = tmp.back();
        tmp.pop_back();
        tmp.push_front(x);
        for(int j=1, i=0; j<teams.size(); j++, i++) teams[j] = tmp[i];
    }


    int T = 1;
    cin >> T;
    for(int cs = 1; cs <= T; ++cs){
        testcase(cs);
    }
}


詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3884kb

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: 0ms
memory: 3648kb

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: 0ms
memory: 3620kb

input:

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

output:

NO
NO
NO
NO
YES
YES
NO
NO
NO
NO

result:

wrong answer expected NO, found YES [5th token]