QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#630776 | #5140. Frozen Scoreboard | wuma123 | WA | 1ms | 3784kb | C++23 | 4.8kb | 2024-10-11 20:22:04 | 2024-10-11 20:22:04 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
#define lmin 240
#define rmax 300
int n,m;//team,problem;
struct Problem{
char verdict;//+代表ac,?代表pending,-代表fail
int presub,allsub,penalty;//封榜前提交次数,总提交次数,单题罚时
int l,r;
};
struct Team{
int AC,Penalty;//ac数,总罚时
Problem problem[14];
}team[5000];
void contradict(int tt){//判断team_i是否矛盾
int AC=team[tt].AC,Penalty=team[tt].Penalty;
for(int i=0;i<(1<<m);i++){//枚举每个题选或者不选,但是ac了一定要选,不ac一定不选,总选取等于AC
int low=0,high=0;
if(__builtin_popcount(i)!=AC) continue;
bool flag=0;
for(int j=0;j<m;j++){
if(i&(1<<j)){
if(team[tt].problem[j+1].verdict=='-'||team[tt].problem[j+1].verdict=='.'){flag=1;break;};
}else{
if(team[tt].problem[j+1].verdict=='+') {flag=1;break;};
}
}
if(flag) continue;
// cout<<bitset<14>(i)<<endl;
for(int j=0;j<m;j++){
if(i&(1<<j)){
if(team[tt].problem[j+1].verdict=='+'){
low+=team[tt].problem[j+1].penalty;
high+=team[tt].problem[j+1].penalty;
}else{
team[tt].problem[j+1].l=team[tt].problem[j+1].penalty+240;
team[tt].problem[j+1].r=(team[tt].problem[j+1].allsub-1)*20+300;
low+=team[tt].problem[j+1].l;
high+=team[tt].problem[j+1].r;
}
}
}
// cout<<high<<" "<<low<<" "<<Penalty<<endl;
if(low<=Penalty&&high>=Penalty){
cout<<"Yes"<<endl;
for(int k=1;k<=m;k++){
int l=team[tt].problem[k].l,r=team[tt].problem[k].r;
if(team[tt].problem[k].verdict=='+'){
cout<<"+ "<<team[tt].problem[k].allsub<<"/"<<team[tt].problem[k].penalty-20*(team[tt].problem[k].allsub-1)<<endl;
}else if(team[tt].problem[k].verdict=='?'){
if(!(i&(1<<(k-1)))){
cout<<"- "<<team[tt].problem[k].allsub<<endl;
continue;
}
if(low+(r-l)<=Penalty){
cout<<"+ "<<team[tt].problem[k].allsub<<"/"<<300<<endl;
low+=(r-l);
}else{
int tim=Penalty-low;//当前差的时间,当前题的罚时去补
int nowsub=team[tt].problem[k].presub;
if(tim<=60){
cout<<"+ "<<team[tt].problem[k].presub+1<<"/"<<240+tim<<endl;
tim=0;
}else{
int cnt=(tim-60)/20+!!((tim-60)%20);
tim-=20*cnt;
cout<<"+ "<<team[tt].problem[k].presub+cnt+1<<"/"<<240+tim<<endl;
tim=0;
}
}
}else if(team[tt].problem[k].verdict=='-'){
cout<<"- "<<team[tt].problem[k].allsub<<endl;
}else{
cout<<'.'<<endl;
}
}
return;
}
}
cout<<"No"<<endl;
}
void solve(){
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>team[i].AC>>team[i].Penalty;
for(int j=1;j<=m;j++){
cin>>team[i].problem[j].verdict;
if(team[i].problem[j].verdict=='+'){
int x=0,y=0;string s;bool flag=0;
cin>>s;
for(auto it:s){
if(it!='/'&&!flag) x*=10,x+=it-'0';
else if(it=='/') flag=1;
else y*=10,y+=it-'0';
}
team[i].problem[j].allsub=x;
team[i].problem[j].penalty=20*(x-1)+y;
}else if(team[i].problem[j].verdict=='?'){
cin>>team[i].problem[j].presub>>team[i].problem[j].allsub;
team[i].problem[j].presub=team[i].problem[j].allsub-team[i].problem[j].presub;
if(team[i].problem[j].presub==team[i].problem[j].allsub)
team[i].problem[j].verdict='-';
team[i].problem[j].penalty=team[i].problem[j].presub*20;
}else if(team[i].problem[j].verdict=='-'){
cin>>team[i].problem[j].allsub;
}
}
}
for(int i=1;i<=n;i++){
contradict(i);
}
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
// cout<<(1000ll*(1<<13))<<endl;
int t=1;
while(t--){
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
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 + 2/263 + 4/183 - 2 + 3/217 . . . + 2/29 + 1/91 . + 1/22 .
result:
ok ok (1 test case)
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3508kb
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 + 86/300 - 100
result:
wrong answer submit time should be between 0 and 299 (test case 6)