QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#875793#9979. Corrupted Scoreboard LogwjwweiweiWA 0ms3712kbC++142.3kb2025-01-30 13:05:322025-01-30 13:05:32

Judging History

This is the latest submission verdict.

  • [2025-01-30 13:05:32]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3712kb
  • [2025-01-30 13:05:32]
  • Submitted

answer

#include<bits/stdc++.h>
#define fone "try"
#define fmore "tries"
using namespace std;
const int N=505;
using ll=long long;
int n,m;
string s;
int prob,tott;
int cnt=0;
struct node{
	bool sol;
	int subm,myt;
}now[N];
inline int gtn(int l,int r){
	ll res=0;
	for(int i=l;i<=r;i++){
		res=res*10+s[i]-'0';
		if(s[i]<'0'||s[i]>'9')assert(0);
	}
	if(res>1e9)assert(0);
	return res;
}
inline string gts(int l,int r){return s.substr(l,r-l+1);}
bool solve(int l,int r,int cur){
	if(cnt>m)return 0;
	if(l>r){
		int curp=0,curt=0;
		for(int i=1;i<=cnt;i++){
			if(!now[i].sol)continue;
			int subm=now[i].subm,myt=now[i].myt;
			curp++;curt+=(subm-1)*20+myt;
			if(subm>100)return 0;
			if(myt>=300)return 0;
		}
		if(curp==prob&&tott==curt)return 1;
		return 0;
	}
	int pos=l;
	if(cur==1){
		while(pos<n&&pos-l<=0&&s[pos+1]>='0'&&s[pos+1]<='9')pos++;
		prob=gtn(l,l);
		if(prob<=m&&solve(l+1,r,2))return 1;
		if(pos^l){
			prob=gtn(l,pos);
			if(prob<=13){
				if(prob<=m&&solve(l+2,r,2))return 1;
			}
		}
		return 0;
	}
	if(cur==2){
		while(pos<n&&pos-l<=3&&s[pos+1]>='0'&&s[pos+1]<='9')pos++;
		for(int i=l;i<=pos;i++){
			tott=gtn(l,i);
			if(solve(i+1,r,3))return 1;
		}
		return 0;
	}
	if(s[l]<'0'||s[l]>'9')return 0;
	while(pos<n&&s[pos+1]>='0'&&s[pos+1]<='9')pos++;
	if(s[pos+1]!='t')assert(0);
	int nxt=pos+1;
	while(nxt<n&&s[nxt+1]<='z'&&s[nxt+1]>='a')nxt++;
	string p=gts(pos+1,pos+3);
	bool fl=0;
	if(p=="tri")fl=1;
	int spec=gtn(l,pos);
	if((spec==1&&fl==0)||(spec>1&&fl==1)){
		if(spec<=100){
			now[++cnt]={0,spec,0};
			if(solve(nxt+1,r,3))return 1;
			cnt--;
		}
	}
	for(int i=l;i<pos;i++){
		int pl=gtn(l,i),pr=gtn(i+1,pos);
		if(pr==0)continue;
		if(fl&&pr==1)continue;
		if(!fl&&pr>1)continue;
		if(pl>=300)continue;
		if(pr>100)continue;
		now[++cnt]={1,pr,pl};
		if(solve(nxt+1,r,3))return 1;
		cnt--;
	}
	return 0;
}
int T;
int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>T>>m;
	while(T--){
		cnt=0;
		cin>>s;n=s.length();s="*"+s;s+="*";
		if(!solve(1,n,1))assert(0);
		cout<<prob<<" "<<tott;
		for(int i=1;i<=cnt;i++){
			cout<<" ";
			if(now[i].sol)cout<<now[i].myt<<" ";
			cout<<now[i].subm<<" ";
			if(now[i].subm>1)cout<<fmore;
			else cout<<fone;
		}
		if(T)cout<<"\n";
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4 12
99351583tries261try312tries231try4tries431try2412tries551try991try1791try
912121482tries572tries392tries821try4tries431try521try2492tries1842tries2183tries
912181082tries141try542tries922tries6tries302tries6tries502tries2441try1956tries1714tries
913221241try261try542tries1331try2002tries621try2...

output:

9 935 158 3 tries 26 1 try 31 2 tries 23 1 try 4 tries 43 1 try 241 2 tries 55 1 try 99 1 try 179 1 try
9 1212 148 2 tries 57 2 tries 39 2 tries 82 1 try 4 tries 43 1 try 52 1 try 249 2 tries 184 2 tries 218 3 tries
9 1218 108 2 tries 14 1 try 54 2 tries 92 2 tries 6 tries 30 2 tries 6 tries 50 2 tr...

result:

ok 4 lines (4 test cases)

Test #2:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

5 2
0022tries22tries
12222tries22tries
24422tries22tries
284222tries222tries
2844222tries222tries

output:

0 0 22 tries 22 tries
1 22 22 tries 2 2 tries
2 44 2 2 tries 2 2 tries
2 84 22 2 tries 22 2 tries
2 844 2 22 tries 2 22 tries

result:

ok 5 lines (5 test cases)

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3712kb

input:

500 13
91481641try2951try511try1try1291try2781try1331try651try1961try1try2701try
001try1try1try1try1try
131200151try201try151try151try361try881try1231try1761try1921try1901try341try2061try901try
1325842381try131try1621try2961try2261try1891try1091try1701try971try2961try2761try2651try2471try
916741021t...

output:

9 1481 64 1 try 295 1 try 51 1 try 1 try 129 1 try 278 1 try 133 1 try 65 1 try 196 1 try 1 try 270 1 try
0 0 1 try 1 try 1 try 1 try 1 try
13 1200 15 1 try 20 1 try 15 1 try 15 1 try 36 1 try 88 1 try 123 1 try 176 1 try 192 1 try 190 1 try 34 1 try 206 1 try 90 1 try
13 2584 238 1 try 13 1 try 162...

result:

wrong answer It is not same after removing spaces (test case 439)