QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#648358 | #5140. Frozen Scoreboard | zhoudashuai | Compile Error | / | / | C++14 | 3.2kb | 2024-10-17 18:36:51 | 2024-10-17 18:36:51 |
Judging History
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;
}
void solve(){
sum=tot=flag=0;
sol(u+1,la+1);
A[u].f=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();
}
}
详细
answer.code: In function ‘void solve()’: answer.code:118:13: error: ‘u’ was not declared in this scope 118 | sol(u+1,la+1); | ^ answer.code:118:17: error: ‘la’ was not declared in this scope; did you mean ‘ll’? 118 | sol(u+1,la+1); | ^~ | ll answer.code:120:17: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=] 120 | scanf("%d%d",&num,&Tim); | ~^ ~~~~ | | | | int* long long int* | %lld answer.code:120:19: warning: format ‘%d’ expects argument of type ‘int*’, but argument 3 has type ‘long long int*’ [-Wformat=] 120 | scanf("%d%d",&num,&Tim); | ~^ ~~~~ | | | | int* long long int* | %lld answer.code:125:33: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=] 125 | scanf("%d",&a[i].cnt); | ~^ ~~~~~~~~~ | | | | | long long int* | int* | %lld answer.code:127:33: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=] 127 | scanf("%d/%d",&a[i].cnt,&a[i].tim); | ~^ ~~~~~~~~~ | | | | int* long long int* | %lld answer.code:127:36: warning: format ‘%d’ expects argument of type ‘int*’, but argument 3 has type ‘long long int*’ [-Wformat=] 127 | scanf("%d/%d",&a[i].cnt,&a[i].tim); | ~^ ~~~~~~~~~ | | | | int* long long int* | %lld answer.code:131:33: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=] 131 | scanf("%d%d",&a[i].tim,&a[i].cnt); | ~^ ~~~~~~~~~ | | | | int* long long int* | %lld answer.code:131:35: warning: format ‘%d’ expects argument of type ‘int*’, but argument 3 has type ‘long long int*’ [-Wformat=] 131 | scanf("%d%d",&a[i].tim,&a[i].cnt); | ~^ ~~~~~~~~~ | | | | int* long long int* | %lld answer.code:120:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 120 | scanf("%d%d",&num,&Tim); | ~~~~~^~~~~~~~~~~~~~~~~~ answer.code:125:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 125 | scanf("%d",&a[i].cnt); | ~~~~~^~~~~~~~~~~~~~~~ answer.code:127:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 127 | scanf("%d/%d",&a[i].cnt,&a[i].tim); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ answer.code:131:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 131 | scanf("%d%d",&a[i].tim,&a[i].cnt); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~