QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#693587#5140. Frozen ScoreboardIsacBieberWA 0ms3832kbC++233.4kb2024-10-31 16:26:112024-10-31 16:26:14

Judging History

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

  • [2024-10-31 16:26:14]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3832kb
  • [2024-10-31 16:26:11]
  • 提交

answer

#include <bits/stdc++.h>
// #include<bits/extc++.h>
#define endl '\n'
#define eps 1e-7
#define pb push_back
#define eb emplace_back
#define debug(x) cerr<<#x<<": "<<x<<'\n';
// using namespace __gnu_pbds;
using namespace std;
using ll = long long;
using ld = long double;
using pll = pair <ll,ll>;
using pii = pair <int,int>;
using ull = unsigned long long;
const int N = 1e3 + 5, M = 25, MOD = 1e9 + 7;
mt19937_64 rnd (chrono::steady_clock::now().time_since_epoch().count());
bool flag;
int n, m, pass, fashi, now, t;
array<int,3> info[M], ans[M];
vector <int> v;
void dfs(int u,int have) // 有have个,需要pass-now个
{
    if(u>m+1 || flag) return ;
    if(have==pass-now)
    {
        int mn = 0;
        for(auto idx:v)
        {
            auto [op,x,y] = info[idx];
            mn += 240 + (y-x)*20;
        } 
        // for(int i=1;i<=m;i++) ans[i] = info[i];
        if(t+mn<=fashi)
        {
            int d = fashi - (t+mn);
            for(auto idx:v)
            {
                auto [op,x,y] = info[idx];
                int bu = 299 + (y-1)*20 - (240 + (y-x)*20);
                if(d-bu>=0)
                {
                    d -= bu;
                    int g = min(x,bu/20+1);
                    ans[idx] = {0,y,299};
                }
                else
                {
                    int g = min(x,d/20+1);
                    ans[idx] = {0,y-x+g,240+d-(g-1)*20};
                    assert(240+d-(g-1)*20<=299);
                    d = 0;
                }
            }
            if(!d) flag = 1;
        }
        return ;
    }
    dfs(u+1,have);
    if(info[u][0]==2)
    {
        v.eb(u);
        dfs(u+1,have+1);
        v.pop_back();
    }
}
void isac()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)
    {
        cin>>pass>>fashi;
        now = 0, t = 0;
        for(int j=1;j<=m;j++)
        {
            char op[2];
            scanf("%s", op);
            if(op[0] == '+') 
            {
                info[j][0] = 0;
                scanf("%d/%d", &info[j][1], &info[j][2]);
                now ++;
                t += (info[j][1]-1)*20 + info[j][2];
            }
            else if(op[0] == '-') 
            {
                info[j][0] = 1;
                scanf("%d", &info[j][1]);
            }
            else if(op[0] == '?')
            { 
                info[j][0] = 2;
                scanf("%d%d", &info[j][1], &info[j][2]);
            }
            else info[j][0] = 3;
            ans[j] = info[j];
        } 
        int need = pass - now;
        if(need<0 || fashi<t) cout<<"No\n";
        else
        {
            v.clear();
            flag = 0;
            dfs(1,0);
            if(flag)
            {
                cout<<"Yes\n";
                for(int i=1;i<=m;i++)
                {
                    if(!ans[i][0]) cout<<"+ "<<ans[i][1]<<"/"<<ans[i][2]<<'\n';
                    else if(ans[i][0]==1) cout<<"- "<<ans[i][1]<<'\n';
                    else if(ans[i][0]==2) cout<<"- "<<ans[i][2]<<'\n';
                    else cout<<".\n";
                }
            }
            else cout<<"No\n";
        }
    }
}
int main(void)
{
    int T = 1;
    while (T--) isac();
    return 0;
}
/*
    Zena youth together.
    Such a pretty name.
    There will be a long story.
    fashi will tell all.
*/

詳細信息

Test #1:

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

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: 3760kb

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

result:

ok ok (6 test cases)

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3676kb

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

result:

wrong answer wrong number of solved problems (test case 15)