why #3 TLE
查看原帖
why #3 TLE
1373205
dg114514楼主2025/6/20 16:54

rt,

#include<bits/stdc++.h>
#define int long long
constexpr int R=200;
using namespace std;
string stk,s[100005],S;int ans=0;
signed main(){
	int l;
	for(l=1;s[l-1]!="EOF";l++){
		getline(cin,S);
		for(auto &i:S)
			if(i=='<') {if(!s[l].empty()) s[l].pop_back();}
			else s[l]+=i;
	}
	l-=2;
	for(int i=1;i<=l;i++){
		getline(cin,S);
		stk.clear();
		for(auto &j:S)
			if(j=='<') {if(!stk.empty()) stk.pop_back();}
			else stk+=j;
		for(int j=0;j<min(s[i].size(),stk.size());j++)
			ans+=(stk[j]==s[i][j]);
	}
	S="14";
	while(S!="EOF") getline(cin,S);
	int t;cin>>t;
	cout<<(long long)(ans*60.0/t+0.5);
}
2025/6/20 16:54
加载中...