QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#630765#5140. Frozen Scoreboard7islands#WA 0ms3624kbC++174.8kb2024-10-11 20:19:272024-10-11 20:19:27

Judging History

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

  • [2024-10-11 20:19:27]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3624kb
  • [2024-10-11 20:19:27]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
#define lmin 240
#define rmax 300
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+300;
                    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<<"\\"<<300<<endl;
                        low+=(r-l);
                    }else{
                        int tim=Penalty-low;//当前差的时间,当前题的罚时去补
                        int nowsub=team[tt].problem[k].presub;
                        if(tim<=60){
                            cout<<"+ "<<team[tt].problem[k].presub+1<<"\\"<<240+tim<<endl;
                            tim=0;
                        }else{
                            int cnt=(tim-60)/20+!!((tim-60)%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: 0
Wrong Answer
time: 0ms
memory: 3624kb

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:

wrong answer Token "1\6" doesn't correspond to pattern "[0-9]{1,3}/[0-9]{1,3}" (test case 1)