QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#732599#5140. Frozen Scoreboardheyuhao#WA 2ms3868kbC++205.6kb2024-11-10 15:17:292024-11-10 15:17:29

Judging History

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

  • [2024-11-10 15:17:29]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3868kb
  • [2024-11-10 15:17:29]
  • 提交

answer

#pragma GCC optimize(3, "Ofast", "inline")
#include <iostream>
#include<map>
#include<vector>
//  #include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define INF 0x3f3f3f3f
#define L_INF 0x7f3f3f3f3f3f3f3f
#define db cout << "debug\n";

using namespace std;
const int Mod = 998244353;
using ll = long long;
int m;
struct problem
{
    int index;
    int flag;               //flag {0,没做} {1,过了} {2,没过} {3,可能过}
    int sub,time,sub_time;  // sub 提交次数 time 罚时 sub_time 提交时间
    int bef,aft;            // bef 封榜前提交 aft 封榜后提交
    int most,least;         //most 最多罚时 least 最少罚时
    bool st;
}p[14];
bool cmp(problem a,problem b)
{
    if(a.most!=b.most)
        return a.most>b.most;
    return a.least<b.least;
}
void solve()
{
    int num,time;
    cin>>num>>time;
    vector<problem> all;
    for(int i=1;i<=m;i++)
    {
        p[i].index=i;
        string s;
        cin>>s;
        if(s=="+")
        {
            p[i].flag=1;
            string ss;
            cin>>ss;
            int pos=0;
            p[i].sub=0;
            while(ss[pos]!='/')
            {
                p[i].sub=p[i].sub*10+ss[pos]-'0';
                pos++;
            }
            p[i].time=0;
            for(int j=pos+1;j<ss.size();j++)
            {
                p[i].time=p[i].time*10+ss[j]-'0';
            }
            p[i].sub_time=p[i].time;
            p[i].time+=(p[i].sub-1)*20;
        }
        else if(s=="?")
        {
            p[i].flag=3;
            int x,y;
            cin>>x>>y;
            p[i].bef=y-x;
            p[i].aft=x;
            p[i].most=299+20*(y-1);
            p[i].least=240+20*(p[i].bef);
            p[i].st=false;
            all.push_back(p[i]);
        }
        else if(s=="-")
        {
            p[i].flag=2;
            cin>>p[i].sub;
        }
        else
        {
            p[i].flag=0;
        }
    }
    int now_num=0,now_time=0;
    for(int i=1;i<=m;i++)
    {
        if(p[i].flag==1)
        {
            now_num++;
            now_time+=p[i].time;
        }

    }
//    cout<<now_num<<" "<<now_time<<"\n";
    if(num<now_num||num==now_num&&time!=now_time||num>now_num&&(now_num+all.size()<num))
    {
        cout<<"No\n";
        return;
    }
    if(num==now_num)
    {
        cout<<"Yes\n";
        for(int i=1;i<=m;i++)
        {
            if(p[i].flag==0)
            {
                cout<<".\n";
            }
            else if(p[i].flag==1)
            {
                cout<<"+ "<<p[i].sub<<"/"<<p[i].sub_time<<"\n";
            }
            else if(p[i].flag==2)
            {
                cout<<"- "<<p[i].sub<<"\n";
            }
        }
        return;
    }
    int new_sub=num-now_num,new_time=time-now_time;
    new_time-=new_sub*240;
    if(new_time<0)
    {
        cout<<"No\n";
        return;
    }
//    sort(all.begin(),all.end(),cmp);
    int x=1<<all.size();
    bool ans=false;
    for(int j=1;j<x;j++)
    {
        int p=j;
        int cnt=0;
        while (p)
        {
            if(p&1)
                cnt++;
            p>>=1;
        }
        if(cnt!=new_sub)
            continue;
        int min_sum=0,max_sum=0;
        for(int i=0;i<all.size();i++)
        {
            if(((1<<i)&j)==0)
                continue;
            min_sum+=all[i].bef*20;
            max_sum=all[i].most-240;
        }
        if(new_time>=min_sum&&new_time<=max_sum)
        {
            // cout<<j<<"\n";
            new_time-=min_sum;
            for(int i=0;i<all.size();i++)
            {
                if(((1<<i)&j)==0)
                    continue;
                all[i].st=true;
                int atf=min(all[i].aft-1,new_time/20);
                new_time-=atf*20;
                int aftt=min(59,new_time);
                new_time-=aftt;
                all[i].sub=all[i].bef+atf+1;
                all[i].sub_time=240+aftt;
            }
            ans= true;
            break;
        }
    }
//    for(auto &c:all)
//    {
//        if(new_time<c.bef*20)
//            continue;
//        new_time-=c.bef*20;
//        c.st=true;
//        int atf=min(c.aft-1,new_time/20);
//        new_time-=atf*20;
//        int aftt=min(59,new_time);
//        new_time-=aftt;
//        c.sub=c.bef+atf+1;
//        c.sub_time=240+aftt;
//        if(new_time==0)
//            break;
//    }
    if(ans==false)
    {
        cout<<"No\n";
        return;
    }
    for(auto &c:all)
    {
        if(c.st)
        {
            int pos=c.index;
            p[pos].flag=1;
            p[pos].sub=c.sub;
            p[pos].sub_time=c.sub_time;
        }
        else
        {
            int pos=c.index;
            p[pos].flag=2;
            p[pos].sub=c.bef+c.aft;
        }
    }
    cout<<"Yes\n";
    for(int i=1;i<=m;i++)
    {
        if(p[i].flag==0)
        {
            cout<<".\n";
        }
        else if(p[i].flag==1)
        {
            cout<<"+ "<<p[i].sub<<"/"<<p[i].sub_time<<"\n";
        }
        else if(p[i].flag==2)
        {
            cout<<"- "<<p[i].sub<<"\n";
        }
    }
}
int main()
{
    IOS;
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
#ifndef ONLINE_JUDGE
    clock_t start_time = clock();
#endif
    int t;
    t = 1;
    cin >> t>>m;
    while (t--)
    {
        solve();
    }
#ifndef ONLINE_JUDGE
    cout << "Used " << (double)(clock() - start_time) << " ms" << endl;
#endif
    return 0;
}

详细

Test #1:

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

input:

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

output:

Yes
+ 1/6
+ 3/243
+ 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: 3556kb

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
+ 89/240
- 100

result:

ok ok (6 test cases)

Test #3:

score: -100
Wrong Answer
time: 2ms
memory: 3868kb

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
+ 3/258
- 5
- 3
- 5
+ 1/240
- 3
- 5
+ 1/165
- 6
+ 4/240
Yes
- 2
- 9
.
- 1
- 7
- 6
+ 4/179
- 2
+ 5/251
.
- 2
- 3
.
Yes
.
- 2
.
- 2
- 1
- 2
- 2
.
.
.
.
+ 3/100
.
Yes
+ 1/195
.
.
.
.
.
.
.
.
.
.
.
Yes
.
.
.
.
.
.
.
.
.
.
.
.
.
Yes
- 22
- 8
- 6
+ 1/173
- 11
- 9
- 3
- 6
+ 6/254
- ...

result:

wrong answer 10-th verdict can't be . (test case 4)