QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#630781#5140. Frozen Scoreboardwuma123WA 11ms4300kbC++234.8kb2024-10-11 20:23:562024-10-11 20:23:57

Judging History

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

  • [2024-10-11 20:23:57]
  • 评测
  • 测评结果:WA
  • 用时:11ms
  • 内存:4300kb
  • [2024-10-11 20:23:56]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
#define lmin 240
#define rmax 299
int n,m;//team,problem;
struct Problem{
    char verdict;//+代表ac,?代表pending,-代表fail
    int presub,allsub,penalty;//封榜前提交次数,总提交次数,单题罚时
    int l,r;
};
struct Team{
    int AC,Penalty;//ac数,总罚时
    Problem problem[14];
}team[5000];
void contradict(int tt){//判断team_i是否矛盾
    int AC=team[tt].AC,Penalty=team[tt].Penalty;             
    for(int i=0;i<(1<<m);i++){//枚举每个题选或者不选,但是ac了一定要选,不ac一定不选,总选取等于AC
        int low=0,high=0;
        if(__builtin_popcount(i)!=AC) continue;
        bool flag=0;
        for(int j=0;j<m;j++){
            if(i&(1<<j)){
                if(team[tt].problem[j+1].verdict=='-'||team[tt].problem[j+1].verdict=='.'){flag=1;break;};
            }else{
                if(team[tt].problem[j+1].verdict=='+') {flag=1;break;};
            } 
        }
        if(flag) continue;
        // cout<<bitset<14>(i)<<endl;
        for(int j=0;j<m;j++){
            if(i&(1<<j)){
                if(team[tt].problem[j+1].verdict=='+'){
                    low+=team[tt].problem[j+1].penalty;
                    high+=team[tt].problem[j+1].penalty;
                }else{
                    team[tt].problem[j+1].l=team[tt].problem[j+1].penalty+240;
                    team[tt].problem[j+1].r=(team[tt].problem[j+1].allsub-1)*20+299;
                    low+=team[tt].problem[j+1].l;
                    high+=team[tt].problem[j+1].r;
                }
            }
        }
        // cout<<high<<" "<<low<<" "<<Penalty<<endl;
        if(low<=Penalty&&high>=Penalty){
            cout<<"Yes"<<endl;
            for(int k=1;k<=m;k++){
                int l=team[tt].problem[k].l,r=team[tt].problem[k].r;
                if(team[tt].problem[k].verdict=='+'){
                    cout<<"+ "<<team[tt].problem[k].allsub<<"/"<<team[tt].problem[k].penalty-20*(team[tt].problem[k].allsub-1)<<endl;
                }else if(team[tt].problem[k].verdict=='?'){
                    if(!(i&(1<<(k-1)))){
                        cout<<"- "<<team[tt].problem[k].allsub<<endl;
                        continue;
                    }
                    if(low+(r-l)<=Penalty){
                        cout<<"+ "<<team[tt].problem[k].allsub<<"/"<<299<<endl;
                        low+=(r-l);
                    }else{
                        int tim=Penalty-low;//当前差的时间,当前题的罚时去补
                        int nowsub=team[tt].problem[k].presub;
                        if(tim<=59){
                            cout<<"+ "<<team[tt].problem[k].presub+1<<"/"<<240+tim<<endl;
                            tim=0;
                        }else{
                            int cnt=(tim-59)/20+!!((tim-59)%20);
                            tim-=20*cnt;
                            cout<<"+ "<<team[tt].problem[k].presub+cnt+1<<"/"<<240+tim<<endl;
                            tim=0;
                        }
                    } 
                }else if(team[tt].problem[k].verdict=='-'){
                    cout<<"- "<<team[tt].problem[k].allsub<<endl;
                }else{
                    cout<<'.'<<endl;
                }
            }
            return;
        }
    }
    cout<<"No"<<endl;
}
void solve(){
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        cin>>team[i].AC>>team[i].Penalty;
        for(int j=1;j<=m;j++){
            cin>>team[i].problem[j].verdict;
            if(team[i].problem[j].verdict=='+'){
                int x=0,y=0;string s;bool flag=0;
                cin>>s;
                for(auto it:s){
                    if(it!='/'&&!flag) x*=10,x+=it-'0';
                    else if(it=='/') flag=1;
                    else y*=10,y+=it-'0'; 
                }
                team[i].problem[j].allsub=x;
                team[i].problem[j].penalty=20*(x-1)+y;
            }else if(team[i].problem[j].verdict=='?'){
                cin>>team[i].problem[j].presub>>team[i].problem[j].allsub;
                team[i].problem[j].presub=team[i].problem[j].allsub-team[i].problem[j].presub;
                if(team[i].problem[j].presub==team[i].problem[j].allsub)
                team[i].problem[j].verdict='-';
                team[i].problem[j].penalty=team[i].problem[j].presub*20;
            }else if(team[i].problem[j].verdict=='-'){
                cin>>team[i].problem[j].allsub;
            }
        }
    }
    for(int i=1;i<=n;i++){
        contradict(i);
    }
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    // cout<<(1000ll*(1<<13))<<endl;
    int t=1;
    while(t--){
        solve();
    }
    return 0;
}

详细

Test #1:

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

input:

1 13
7 951
+ 1/6
? 3 4
+ 4/183
- 2
+ 3/217
.
.
.
+ 2/29
+ 1/91
.
+ 1/22
.

output:

Yes
+ 1/6
+ 2/263
+ 4/183
- 2
+ 3/217
.
.
.
+ 2/29
+ 1/91
.
+ 1/22
.

result:

ok ok (1 test case)

Test #2:

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

input:

6 2
1 100
.
? 3 4
2 100
+ 1/1
+ 1/2
0 0
- 5
- 6
2 480
? 100 100
? 100 100
2 480
? 99 100
? 100 100
1 2000
? 100 100
? 100 100

output:

No
No
Yes
- 5
- 6
Yes
+ 1/240
+ 1/240
No
Yes
+ 87/280
- 100

result:

ok ok (6 test cases)

Test #3:

score: -100
Wrong Answer
time: 11ms
memory: 4300kb

input:

1000 13
6 1519
+ 3/183
- 1
+ 9/133
? 2 3
- 5
? 1 3
- 5
? 1 1
? 1 3
- 5
+ 1/165
- 6
? 2 5
2 570
- 2
- 9
.
- 1
- 7
- 6
+ 4/179
- 2
? 2 5
.
- 2
? 1 3
.
1 140
.
- 2
.
- 2
- 1
- 2
- 2
.
.
.
.
+ 3/100
.
1 195
+ 1/195
.
.
.
.
.
.
.
.
? 1 1
.
.
.
0 0
.
.
.
.
.
.
.
.
.
.
.
.
.
3 776
? 8 22
? 1 8
- 6
+ 1/173
...

output:

Yes
+ 3/183
- 1
+ 9/133
+ 2/298
- 5
+ 3/298
- 5
+ 1/298
- 3
- 5
+ 1/165
- 6
- 5
Yes
- 2
- 9
.
- 1
- 7
- 6
+ 4/179
- 2
+ 4/271
.
- 2
- 3
.
Yes
.
- 2
.
- 2
- 1
- 2
- 2
.
.
.
.
+ 3/100
.
Yes
+ 1/195
.
.
.
.
.
.
.
.
- 1
.
.
.
Yes
.
.
.
.
.
.
.
.
.
.
.
.
.
Yes
- 22
- 8
- 6
+ 1/173
- 11
- 9
- 3
- 6
+ 4/29...

result:

wrong answer wrong total time (test case 1)