QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#695718#5499. AliasesOOBMABTRAMS#Compile Error//C++14928b2024-10-31 20:39:502024-10-31 20:39:51

Judging History

你现在查看的是最新测评结果

  • [2024-10-31 20:39:51]
  • 评测
  • [2024-10-31 20:39:50]
  • 提交

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();
}

Details

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