QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#610798 | #5140. Frozen Scoreboard | zake | WA | 2ms | 3784kb | C++17 | 2.7kb | 2024-10-04 17:28:11 | 2024-10-04 17:28:12 |
Judging History
answer
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
struct node{
char op;
int x,time,id;
};
struct node1{
int sub,x,id;
int mn,mx;
};
bool cmp(node1 a,node1 b){
if(a.mn==b.mn) return a.mx>b.mx;
return a.mn<b.mn;
}
bool cmp1(node1 a,node1 b){
if(a.mx==b.mx) return a.mn<b.mn;
return a.mx>b.mx;
}
int number_of_1(int m)
{
int count = 0;
while (m)
{
m = m & (m - 1);
count++;
}
return count;
}
const int N=2e5+5;
node a[N];
signed main(){
ios::sync_with_stdio(0); cin.tie(0);
int n,m;
cin>>n>>m;
while(n--){
int flag1=0;
int x,time;
cin>>x>>time;
int nowt=0,nowx=0;
vector<node1> res;
for(int i=1;i<=m;i++){
cin>>a[i].op;
a[i].id=i;
if(a[i].op=='+'){
string s;
cin>>s;
int xx=0,tt=0;
bool flag=0;
for(auto e:s){
if(e=='/'){
flag=1;
continue;
}
if(!flag) xx=xx*10+(int)(e-'0');
else tt=tt*10+(int)(e-'0');
}
a[i].x=xx;
a[i].time=tt;
nowt+=tt+(xx-1)*20;
nowx++;
}
else if(a[i].op=='?'){
node1 tmp;
tmp.id=i;
cin>>tmp.sub>>tmp.x;
tmp.mn=240+(tmp.x-tmp.sub)*20;
tmp.mx=299+(tmp.x-1)*20;
res.pb(tmp);
}
else if(a[i].op=='-'){
cin>>a[i].x;
}
}
int tt=time-nowt;
int cnt1=x-nowx;
int S=res.size();
for(int i=0;i<(1<<S);i++){
if(number_of_1(i)!=cnt1){
continue;
}
for(int j=0;j<S;j++){
if((i>>j)&1){
tt-=(240+(res[j].x-res[j].sub)*20);
}
}
if(tt<0){
continue;
}
for(int j=0;j<S;j++){
if((i>>j)&1){
tt-=min(res[j].sub-1,tt/20)*20;
}
}
for(int j=0;j<S;j++){
if((i>>j)&1){
tt-=min(tt,59);
}
}
if(tt==0){
tt=time-nowt;
for(int j=0;j<S;j++){
if((i>>j)&1){
a[res[j].id].op='+';
tt-=(240+(res[j].x-res[j].sub)*20);
}else{
a[res[j].id].op='-';
a[res[j].id].x=res[j].x;
}
}
for(int j=0;j<S;j++){
if((i>>j)&1){
int tmp=min(res[j].sub-1,tt/20);
tt-=tmp*20;
a[res[j].id].x=res[j].x-res[j].sub+tmp+1;
a[res[j].id].time=240;
}
}
for(int j=0;j<S;j++){
if((i>>j)&1){
a[res[j].id].time+=min(tt,59);
tt-=min(tt,59);
}
}
cout<<"Yes\n";
for(int i=1;i<=m;i++){
if(a[i].op=='+'){
cout<<"+ "<<a[i].x<<"/"<<a[i].time<<'\n';
}else if(a[i].op=='-'){
cout<<"- "<<a[i].x<<'\n';
}else{
cout<<"."<<'\n';
}
}
flag1=1;
break;
}
}
if(flag1==0)
cout<<"No\n";
}
return 0;
}
/*
1 13
6 1519
+ 3/183
- 1
+ 9/133
? 2 3
- 5
? 1 3
- 5
? 1 1
? 1 3
- 5
+ 1/165
- 6
? 2 5
*/
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3784kb
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: 3540kb
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: 3596kb
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 + 3/240 - 5 + 1/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 . . . . . . . . . . . . . No Yes . - 1 + 1/285 - 1 + 1/60 . . - 1 . . . . ...
result:
wrong answer ans finds the answer, but out doesn't (test case 6)