QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#695718 | #5499. Aliases | OOBMABTRAMS# | Compile Error | / | / | C++14 | 928b | 2024-10-31 20:39:50 | 2024-10-31 20:39:51 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf=1e9+7;
const int N=1000013;
string s[N],t[N];
void solve(){
int n;
cin>>n;
for(int i=1;i<=n;i++)cin>>s[i]>>t[i];
if(n==1) {
cout<<"1 0 0\n";
return;
}
int M=0,p=1;
while(p<n)p*=10,M++;
int ans=M;
tuple abc={0,0,M};
for(int i=0;i<M;i++)for(int j=(i==0);i+j<M;j++) {
map<string,int>mp;
for(int o=1;o<=n;o++) {
string u=s[o].substr(0,i)+t[o].substr(0,j);
mp[u]++;
}
int mx=0;
for(auto&[ss,x]:mp)mx=max(mx,x);
p=1;
int r=i+j;
while(p<mx)r++,p*=10;
ans=min(ans,r);
if(ans==r)abc={i,j,r-i-j};
}
auto[a,b,c]=abc;
cout<<a<<' '<<b<<' '<<c<<'\n';
}
int main(){
ios::sync_with_stdio(false);
int T=1;
cin>>T;
while(T--)solve();
}
詳細信息
answer.code: In function ‘void solve()’: answer.code:18:11: error: missing template arguments before ‘abc’ 18 | tuple abc={0,0,M}; | ^~~ answer.code:26:18: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 26 | for(auto&[ss,x]:mp)mx=max(mx,x); | ^ answer.code:31:19: error: ‘abc’ was not declared in this scope; did you mean ‘abs’? 31 | if(ans==r)abc={i,j,r-i-j}; | ^~~ | abs answer.code:33:9: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 33 | auto[a,b,c]=abc; | ^ answer.code:33:17: error: ‘abc’ was not declared in this scope; did you mean ‘abs’? 33 | auto[a,b,c]=abc; | ^~~ | abs