QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#667111 | #5140. Frozen Scoreboard | qinglu09 | WA | 2ms | 3604kb | C++14 | 2.5kb | 2024-10-22 21:06:04 | 2024-10-22 21:06:10 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long LL;
typedef pair<ll, ll>pll;
#define endl '\n'
#define per(i, a, b) for(int i = (a); i >= (b); i--)
#define rep(i, a, b) for(int i = (a); i <= (b); i++)
#define maxn 64
typedef pair<int,int> PII;
int t;
void solve()
{
ll n,m;
cin>>n>>m;
char op[t+1];
string s[t+1];
vector<array<int,3>>path;
map<int,int>yy;
for(int i=1;i<=t;i++)
{
cin>>op[i];
if(op[i]=='.') continue;
else if(op[i]=='+')
{
n--;
cin>>s[i];
int num=0;
int sov,time;
for(int j=0;j<s[i].length();j++)
{
if(s[i][j]=='/')
{
sov=num;
num=0;
}
else num=num*10+s[i][j]-'0';
}
m-=(sov-1)*20;
time=num;
m-=time;
}
else if(op[i]=='-')
{
cin>>s[i];
}
else
{
int x,y;
cin>>x>>y;
yy[i] = y;
path.push_back({i,x,y});
}
}
int cnt=path.size();
int k=1<<(path.size());
for(int i=0;i<k;i++)
{
map<int,int>mp,mp2;
if(__builtin_popcountll(i)!=n) continue;
vector<array<int,3>>now;
for(int j=0;j<cnt;j++)
{
if((i>>j)&1) now.push_back(path[j]);
}
ll mm=m;
ll have=0;
for(auto [id,x,y]:now)
{
mp[id]=x;
mp2[id]=y-x;
mm-=(y-x)*20;
have+=x-1;
}
ll l=mm-299*n;
ll r=mm-240*n;
//l<=[0,have]*20<=r
ll l1 = 0, r1 = have;
while(l1 < r1) {
ll mid = (l1 + r1 + 1) >> 1;
if(mid * 20 <= r) l1 = mid;
else r1 = mid - 1;
}
mm = mm - (l1 * 20);
mm -= 240 * n;
if(l1 * 20 >= l && l1 * 20 <= r)
{
cout<<"Yes"<<endl;
for(int j=1;j<=t;j++)
{
if(op[j]=='+')
{
cout<<"+ "<<s[j]<<endl;
}
else if(op[j]=='.')
{
cout<<"."<<endl;
}
else if(op[j]=='-')
{
cout<<"- "<<s[j]<<endl;
}
else
{
if(mp[j])
{
cout<<"+ ";
if(l1)
{
cout<<mp2[j]+min((int)(l1+1),mp[j]);
cout<<'/';
l1-=min((int)(l1+1),mp[j]);
}
else
{
cout<<mp2[j]+1;
cout<<'/';
}
if(mm>=59)
{
cout<<299<<endl;
mm-=59;
}
else
{
cout<<mm + 240<<endl;
mm=0;
}
}
else
{
cout<<"- "<<yy[j]<<endl;
}
}
}
return;
}
}
cout<<"No"<<endl;
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
int T=1;
cin>>T;
cin>>t;
while(T--)
{
solve();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3512kb
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: 3536kb
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: 3604kb
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/278 - 5 + 2/240 - 5 + 0/240 - 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 6-th number of submission should be in [3, 3] (test case 1)