QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#100716 | #5140. Frozen Scoreboard | lgvc# | WA | 2ms | 3520kb | C++23 | 2.9kb | 2023-04-27 18:51:37 | 2023-04-27 18:51:42 |
Judging History
answer
//这回只花了114514min就打完了。
//真好。记得多手造几组。
#include <bits/stdc++.h>
//#define int long long
#define pai 3.141592653589793238462643383279502884197169399375105820
#define MOD 1000000007
#define eps 0.00000001
inline int min(int a,int b) {return a<b?a:b;}
inline int max(int a,int b) {return a>b?a:b;}
#define ULL unsigned long long
#define LL long long
#define INF 0x3f3f3f3f
#define INF_LL 0x3f3f3f3f3f3f3f3f
static char buf[1000000],*paa=buf,*pd=buf;
static char buf2[1000000],*pp=buf2;
inline void pc(char ch){
if(pp-buf2==1000000) fwrite(buf2,1,1000000,stdout),pp=buf2;
*pp++=ch;
}
inline void pcc(){
fwrite(buf2,1,pp-buf2,stdout);
pp=buf2;
}
inline int read(void) {
int w=1;
register int x(0);register char c(getchar());
while(c<'0'||c>'9') {if(c=='-') w=-1;c=getchar();}
while(c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
return w*x;
}
void write(int x) {
if(x<0) pc('-'),x=-x;
static int sta[20];
int top=0;
do {
sta[top++]=x%10,x/=10;
} while(x);
while(top) pc(sta[--top]+48);
}
void we(int x) {
write(x);
pc('\n');
}
inline bool cmp_xi(int a,int b) {return a<b;}
inline bool cmp_da(int a,int b) {return a>b;}
int N,M,A,B,a[20],b[20];
char s[20][20];
signed main(void) {
//freopen("m.in","r",stdin);
//freopen("m.out","w",stdout);
scanf("%d %d",&N,&M);
while(N--) {
scanf("%d %d",&A,&B);
for(int i=1;i<=M;i++) {
scanf("%s",s[i]+1);
if(s[i][1]=='-') {
a[i]=read();
} else if(s[i][1]!='.') {
a[i]=read();
b[i]=read();
}
if(s[i][1]=='?') a[i]=b[i]-a[i];
}
bool zz=0;
for(int i=0;i<(1<<M);i++) {
if(__builtin_popcount(i)!=A) continue;
bool ff=0;
for(int j=1;j<=M;j++) {
if(s[j][1]=='+'&&((i>>j-1)&1)==0) ff=1;
if(s[j][1]=='-'&&((i>>j-1)&1)) ff=1;
if(s[j][1]=='.'&&((i>>j-1)&1)) ff=1;
}
if(ff) continue;
int x=0,y=0;
for(int j=1;j<=M;j++) {
int l,r;
if(s[j][1]=='.'||s[j][1]=='-') {
l=0,r=0;
} else if(s[j][1]=='+') {
l=b[j]+(a[j]-1)*20;
r=b[j]+(a[j]-1)*20;
} else if((i>>j-1)&1) {
l=240+a[j]*20;
r=299+(b[j]-1)*20;
} else {
l=0;
r=0;
}
x+=l;
y+=r;
}
if(B<x||y<B) continue;
B-=x;
zz=1;
printf("Yes\n");
for(int j=1;j<=M;j++) {
int l,r;
if(s[j][1]=='.'||s[j][1]=='-') {
l=0,r=0;
if(s[j][1]=='.') printf(".\n");
else printf("- %d\n",a[j]);
} else if(s[j][1]=='+') {
l=b[j]+(a[j]-1)*20;
r=b[j]+(a[j]-1)*20;
printf("+ %d/%d\n",a[j],b[j]);
} else if((i>>j-1)&1) {
l=240+a[j]*20;
r=299+(b[j]-1)*20;
int c=r-l,st=a[j]+1;
while(st!=b[j]&&B>=20) st++,B-=20;
int qq=240;
while(qq!=299&&B) qq++,B--;
printf("+ %d/%d\n",st,qq);
} else {
l=0;
r=0;
printf("- %d\n",a[j]);
}
}
break;
}
if(!zz) printf("No\n");
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 3460kb
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: -100
Wrong Answer
time: 2ms
memory: 3520kb
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 - 0
result:
wrong answer Integer 0 violates the range [1, 100] (test case 6)