QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#648364#5140. Frozen ScoreboardzhoudashuaiWA 0ms3840kbC++143.2kb2024-10-17 18:37:502024-10-17 18:37:50

Judging History

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

  • [2024-10-17 18:37:50]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3840kb
  • [2024-10-17 18:37:50]
  • 提交

answer

#include<iostream>
#include<string.h>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<queue>
#include<set> 
#include<stack>
#include<bitset>
#include<unordered_map>
#include<iomanip>
#include<cassert>
#include<array>
#define fi first
#define se second
#define endl '\n'
#define pb push_back
#define ep emplace_back 
#define debug(x) cout<<x<<'\n'
#define RES cout<<res<<'\n'
#define ANS cout<<ans<<'\n'
#define YES	cout<<"YES"<<'\n'
#define NO cout<<"NO"<<'\n'
#define Yes	cout<<"Yes"<<'\n'
#define No cout<<"No"<<'\n'
#define me(a,x) memset(a,x,sizeof(a))
#define L(i,j,k) for(int i=(j);i<=(k);++i)
#define R(i,j,k) for(int i=(j);i>=(k);--i)
#define r23 cout<<233<<endl;return;
#define int long long 
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<PII,int> PIII;
typedef unsigned long long ull;
const int N=1e5+5,P=131,mod=998244353;
int qmi(int a,int b){
	int res=1;
	while(b){
		if(b&1)res=res*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return res;
}
int inv(int a,int b){
	return qmi(a,b-2);
}
int n,m;
int num,Tim;//剩下的过题数,剩下罚时 
int tot;
struct node{
	char c;
	int cnt,tim;
}a[15];
struct Node{
	int f;//是否选择 
	int cnt,tim;//提交次数,封榜后时间
	int cnt1,tim1;//输出的次数,输出的时间 
}A[15];//存问号 
int sum,flag;
int b[1010];
void output(){
	Yes;
	int now=1;
	L(i,1,m){
		if(a[i].c=='.')cout<<"."<<endl;
		else if(a[i].c=='-')cout<<"- "<<a[i].cnt<<endl;
		else if(a[i].c=='+')cout<<"+ "<<a[i].cnt<<'/'<<a[i].tim<<endl;
		else {//?
			if(A[now].f)cout<<"+ "<<A[now].cnt1<<'/'<<A[now].tim1<<endl;
			else cout<<"- "<<A[now].cnt<<endl;
			++now;
		}
	}
}
void sol(int u,int la){
	if(flag)return;
	if(u>tot&&la<=num)return;
	if(la>num){
		int T=Tim-240*num;
		L(i,1,num){
			A[b[i]].tim1=240,T-=(A[b[i]].cnt-A[b[i]].tim)*20;
			A[b[i]].cnt1=A[b[i]].cnt-A[b[i]].tim+1;
			//cout<<b[i]<<'='<<A[b[i]].cnt1<<' '<<A[b[i]].tim1<<endl;
			if(A[b[i]].cnt1>A[b[i]].cnt)return; 
		}
		if(T<0)return;
		L(i,1,num){
			if(T<=20)break;
			if(T>(A[b[i]].tim-1)*20)T-=(A[b[i]].tim-1)*20,A[b[i]].cnt1=A[b[i]].cnt;
			else {
				int t=T/20;
				T-=t*20;
				A[b[i]].cnt1+=t;
			}
		}
		L(i,1,num){
			if(T<=0)break;
			if(T>59)Tim-=59,A[b[i]].tim1=299;
			else if(T>0)A[b[i]].tim1+=T,T=0;
		}
		if(!T){
			//cout<<233<<endl; 
			flag=1;
			output();
		}
		return;
	}
	sol(u+1,la);
	if(flag)return;
	b[la]=u;
	A[u].f=1;
	sol(u+1,la+1);
	A[u].f=0;
}
void solve(){
	sum=tot=flag=0;
	
	scanf("%d%d",&num,&Tim);
	L(i,1,m){
		cin>>a[i].c;
		if(a[i].c=='.')continue;
		else if(a[i].c=='-'){
			scanf("%d",&a[i].cnt);
		}else if(a[i].c=='+'){
			scanf("%d/%d",&a[i].cnt,&a[i].tim);
			Tim-=(a[i].tim+20*a[i].cnt-20);
			num--;
		}else{//?
			scanf("%d%d",&a[i].tim,&a[i].cnt);
			A[++tot].tim=a[i].tim;
			A[tot].cnt=a[i].cnt;
			A[tot].f=0;
			sum+=a[i].cnt-1;
		}
	}
	//cout<<num<<' '<<Tim<<' '<<tot<<endl; 
	if(num<0||Tim<0||tot<num||num*240>Tim||num*299+sum*20<Tim){
		No;return; 
	}
	sol(1,1);
	if(!flag)No;
	
}
signed main(){
	//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	cin>>n>>m;
	while(n--){
		solve();
	}
}




详细

Test #1:

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

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

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

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 total time (test case 15)