QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#732458#5140. Frozen Scoreboardheyuhao#WA 0ms3576kbC++203.9kb2024-11-10 14:37:502024-11-10 14:37:51

Judging History

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

  • [2024-11-10 14:37:51]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3576kb
  • [2024-11-10 14:37:50]
  • 提交

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;
    }
    int new_sub=num-now_num,new_time=time-now_time;
    new_time-=new_sub*240;
    if(new_time<0)
    {
        cout<<"No\n";
    }
    sort(all.begin(),all.end(),cmp);
    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;
    }
    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: 3516kb

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: -100
Wrong Answer
time: 0ms
memory: 3576kb

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
Yes
.
- 4
No
Yes
- 5
- 6
Yes
+ 1/240
- 100
Yes
- 100
+ 1/240
Yes
+ 89/240
- 100

result:

wrong answer 1-th verdict can't be . (test case 2)