QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#278218 | #5140. Frozen Scoreboard | zzuqy | WA | 3ms | 3632kb | C++11 | 2.1kb | 2023-12-07 13:47:46 | 2023-12-07 13:47:47 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int read()
{
int x;cin>>x;
return x;
}
int n,m,cnt,sum,A[20],B[20];
char s[10000],ans[20];
vector<int>a,b,pos;
void work()
{
scanf("%d%d",&cnt,&sum);
a.clear();
b.clear();
pos.clear();
for(int i=1;i<=m;i++)
{
scanf("%s",s);
if(s[0]=='+')
{
int ta,tb;
scanf("%s",s);
sscanf(s,"%d/%d",&ta,&tb);
cnt--;
sum=sum-tb-(ta-1)*20;
ans[i]='+';
A[i]=ta;
B[i]=tb;
}
else if(s[0]=='?')
{
ans[i]='?';
int ta,tb;
scanf("%d %d",&ta,&tb);
a.push_back(ta);
b.push_back(tb);
pos.push_back(i);
}
else if(s[0]=='.')
{
ans[i]='.';
continue;
}
else if(s[0]=='-')
{
ans[i]='-';
scanf("%d",&B[i]);
}
}
for(int now=0;now<(1<<a.size());now++)
{
int tcnt=0;
for(int i=0;i<a.size();i++)
if(now&(1<<i))
tcnt++;
if(tcnt!=cnt)
continue;
int l=0,r=0;
for(int i=0;i<a.size();i++)
{
if(now&(1<<i))
{
ans[pos[i]]='+';
l=l+20*(b[i]-a[i])+240;
r=r+20*(b[i]-1)+299;
}
else
{
ans[pos[i]]='-';
B[pos[i]]=b[i];
}
}
if(l<=sum&&sum<=r)
{
cout<<"Yes\n";
for(int i=0;i<a.size();i++)
{
if(now&(1<<i))
{
if(l-20*(b[i]-1)-299>=sum)
{
sum-=20*(b[i]-1)+299;
r-=20*(b[i]-1)+299;
l-=20*(b[i]-1)+299;
A[pos[i]]=b[i];
B[pos[i]]=299;
}
else if(l==sum)
{
r-=20*(b[i]-a[i])+240;
l-=20*(b[i]-a[i])+240;
sum-=20*(b[i]-a[i])+240;
A[pos[i]]=b[i]-a[i]+1;
B[pos[i]]=240;
}
else
{
int t=sum-l;//需要20罚时啥的
A[pos[i]]=t/20+b[i]-a[i]+1;
B[pos[i]]=240+t%20;
}
}
}
for(int x=1;x<=m;x++)
{
if(ans[x]=='+')
printf("+ %d/%d\n",A[x],B[x]);
else if(ans[x]=='-')
printf("- %d\n",B[x]);
else if(ans[x]=='.')
printf(".\n");
}
return ;
}
}
cout<<"No\n";
}
int main()
{
// freopen("1.in","r",stdin);
n=read();m=read();
for(;n;n--)
{
work();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3632kb
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: 3632kb
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: 3ms
memory: 3576kb
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 + 4/258 - 5 + 5/258 - 5 + 3/258 - 3 - 5 + 1/165 - 6 - 5 Yes - 2 - 9 . - 1 - 7 - 6 + 4/179 - 2 + 5/251 . - 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 + 6/25...
result:
wrong answer 4-th number of submission should be in [2, 3] (test case 1)