제출 #542029

#제출 시각아이디문제언어결과실행 시간메모리
542029__Variatto악어의 지하 도시 (IOI11_crocodile)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>using namespace std;#define pb push_back#define fi first#define se second#define ll long longconst int MAX=7e4+10, A=30, N=20, MAXV=1e6+10;int n, dp[MAX], mini[A], roz[N];int ile[N][A];string s;int main(){ ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0); cin>>n; for(int i=1; i<=n; i++){ cin>>s; roz[i]=s.size(); for(int j=0; j<s.size(); j++) ile[i][s[j]-'a']++; } for(int i=1; i<(1<<n); i++){ int x=i, l=1; bool pierw=true; vector<int>zap; while(x){ if(x%2){ if(pierw){ for(int j=0; j<='z'-'a'; j++) mini[j]=ile[l][j]; pierw=false; } for(int j=0; j<='z'-'a'; j++) mini[j]=min(mini[j], ile[l][j]); zap.pb(l); } x/=2, l++; } dp[i]=MAXV; if(__builtin_popcount(i)==1){ dp[i]=roz[zap[0]]; continue; } int maxi=0; for(int j=0; j<='z'-'a'; j++) maxi+=mini[j]; for(int j=1; j<(1<<int(zap.size()))-1; j++){ int l1=0, x1=j; int maska=0; while(x1){ if(x1%2) maska+=(1<<(zap[l1]-1)); x1/=2, l1++; } dp[i]=min(dp[i], dp[maska]+dp[i^maska]-maxi); //cout<<i<<" "<<maska<<" "<<(i^maska)<<" "<<dp[maska]<<" "<<dp[i^maska]<<" "<<maxi<<"\n"; } } cout<<dp[(1<<n)-1]+1<<"\n";}

컴파일 시 표준 에러 (stderr) 메시지

crocodile.cpp:1:31: warning: extra tokens at end of #include directive
    1 | #include <bits/stdc++.h>using namespace std;#define pb push_back#define fi first#define se second#define ll long longconst int MAX=7e4+10, A=30, N=20, MAXV=1e6+10;int n, dp[MAX], mini[A], roz[N];int ile[N][A];string s;int main(){    ios_base::sync_with_stdio(false);    cin.tie(0), cout.tie(0);    cin>>n;    for(int i=1; i<=n; i++){        cin>>s;        roz[i]=s.size();        for(int j=0; j<s.size(); j++)            ile[i][s[j]-'a']++;    }    for(int i=1; i<(1<<n); i++){        int x=i, l=1;        bool pierw=true;        vector<int>zap;        while(x){            if(x%2){                if(pierw){                    for(int j=0; j<='z'-'a'; j++)                        mini[j]=ile[l][j];                    pierw=false;                }                for(int j=0; j<='z'-'a'; j++)                    mini[j]=min(mini[j], ile[l][j]);                zap.pb(l);            }            x/=2, l++;        }        dp[i]=MAXV;        if(__builtin_popcount(i)==1){            dp[i]=roz[zap[0]];            continue;        }        int maxi=0;        for(int j=0; j<='z'-'a'; j++)            maxi+=mini[j];        for(int j=1; j<(1<<int(zap.size()))-1; j++){            int l1=0, x1=j;            int maska=0;            while(x1){                if(x1%2) maska+=(1<<(zap[l1]-1));                x1/=2, l1++;            }            dp[i]=min(dp[i], dp[maska]+dp[i^maska]-maxi);            //cout<<i<<" "<<maska<<" "<<(i^maska)<<"   "<<dp[maska]<<" "<<dp[i^maska]<<" "<<maxi<<"\n";        }    }    cout<<dp[(1<<n)-1]+1<<"\n";}
      |                               ^~~~~~~~~
crocodile.cpp:1:10: fatal error: bits/stdc++.h>usin: No such file or directory
    1 | #include <bits/stdc++.h>using namespace std;#define pb push_back#define fi first#define se second#define ll long longconst int MAX=7e4+10, A=30, N=20, MAXV=1e6+10;int n, dp[MAX], mini[A], roz[N];int ile[N][A];string s;int main(){    ios_base::sync_with_stdio(false);    cin.tie(0), cout.tie(0);    cin>>n;    for(int i=1; i<=n; i++){        cin>>s;        roz[i]=s.size();        for(int j=0; j<s.size(); j++)            ile[i][s[j]-'a']++;    }    for(int i=1; i<(1<<n); i++){        int x=i, l=1;        bool pierw=true;        vector<int>zap;        while(x){            if(x%2){                if(pierw){                    for(int j=0; j<='z'-'a'; j++)                        mini[j]=ile[l][j];                    pierw=false;                }                for(int j=0; j<='z'-'a'; j++)                    mini[j]=min(mini[j], ile[l][j]);                zap.pb(l);            }            x/=2, l++;        }        dp[i]=MAXV;        if(__builtin_popcount(i)==1){            dp[i]=roz[zap[0]];            continue;        }        int maxi=0;        for(int j=0; j<='z'-'a'; j++)            maxi+=mini[j];        for(int j=1; j<(1<<int(zap.size()))-1; j++){            int l1=0, x1=j;            int maska=0;            while(x1){                if(x1%2) maska+=(1<<(zap[l1]-1));                x1/=2, l1++;            }            dp[i]=min(dp[i], dp[maska]+dp[i^maska]-maxi);            //cout<<i<<" "<<maska<<" "<<(i^maska)<<"   "<<dp[maska]<<" "<<dp[i^maska]<<" "<<maxi<<"\n";        }    }    cout<<dp[(1<<n)-1]+1<<"\n";}
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.