Submission #116654

# Submission time Handle Problem Language Result Execution time Memory
116654 2019-06-13T10:59:43 Z JohnTitor Popeala (CEOI16_popeala) C++11
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, j, k) for(int i=(j); i<=(k); i++)
#define FFOR(i, j, k) for(int i=(j); i<(k); i++)
#define DFOR(i, j, k) for(int i=(j); i>=(k); i--)
#define bug(x) cerr<<#x<<" = "<<(x)<<'\n'
#define pb push_back
#define mp make_pair
#define bit(s, i) (((s)>>(i))&1LL)
#define mask(i) ((1LL<<(i)))
#define builtin_popcount __builtin_popcountll
#define __builtin_popcount __builtin_popcountll
using ll=long long; using ld=long double;
mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); const ld pi=acos(0)*2;
template <typename T> inline void read(T &x){char c; bool nega=0; while((!isdigit(c=getchar()))&&(c!='-')); if(c=='-'){nega=1; c=getchar();} x=c-48; while(isdigit(c=getchar())) x=x*10+c-48; if(nega) x=-x;}
template <typename T> inline void writep(T x){if(x>9) writep(x/10); putchar(x%10+48);}
template <typename T> inline void write(T x){if(x<0){ putchar('-'); x=-x;} writep(x);}
template <typename T> inline void writeln(T x){write(x); putchar('\n');}
#define taskname "Popeala"
int n, t, h;
ll s[20001];
ll x[20001];
string p[51];
int nf[51][20001];
ll nc[51][50001];
ll f[20001];
ll g[20001];
int main(){
    #ifdef Aria
        if(fopen(taskname".in", "r"))
            freopen(taskname".in", "r", stdin);
    #endif // Aria
    read(n);
    read(t);
    read(h);
    FOR(i, 1, t) read(s[i]);
    FOR(i, 1, t) x[i]=x[i-1]+s[i];
    FOR(i, 1, n){
        cin>>p[i];
        p[i]='0'+p[i];
        nf[i][t]=t+1;
        DFOR(j, t-1, 0) if(p[i][j+1]=='0') nf[i][j]=j+1;
        else nf[i][j]=nf[i][j+1];
    }
    FOR(i, 1, t) f[i]=1e18;
    g[0]=1e18;
    FOR(used, 1, h){
        FOR(i, 0, n) FOR(j, 0, t) nc[i][j]=1e18;
        FFOR(i, 0, t) if(f[i]<1e18){
            int cnt=n;
            vector <int> alive;
            FOR(j, 1, n) alive.pb(j);
            int now=i;
            bool first=1;
            while(!alive.empty()){
                nc[alive.size()][now+first]=min(nc[alive.size()][now+first], f[i]-x[i]*alive.size());
                int nxdeath=t+1;
                for(int x: alive) nxdeath=min(nxdeath, nf[x][now]);
                vector <int> nalive;
                for(int x: alive) if(nf[x][now]>nxdeath) nalive.pb(x);
                alive=nalive;
                now=nxdeath;
                first=0;
            }
            if(now<=t) nc[0][now]=min(nc[0][now], f[i]);
        }
        FOR(i, 0, t) f[i]=1e18;
        FOR(c, 0, n){
            FOR(i, 1, t){
                nc[c][i]=min(nc[c][i], nc[c][i-1]);
                f[i]=min(f[i], x[i]*c+nc[c][i]);
            }
        }
        writeln(f[t]);
//        FOR(i, 0, t) cerr<<f[i]<<" \n"[i==t];
    }
}

Compilation message

popeala.cpp: In function 'int main()':
popeala.cpp:56:100: error: no matching function for call to 'min(ll&, long long unsigned int)'
                 nc[alive.size()][now+first]=min(nc[alive.size()][now+first], f[i]-x[i]*alive.size());
                                                                                                    ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from popeala.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
popeala.cpp:56:100: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
                 nc[alive.size()][now+first]=min(nc[alive.size()][now+first], f[i]-x[i]*alive.size());
                                                                                                    ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from popeala.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
popeala.cpp:56:100: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
                 nc[alive.size()][now+first]=min(nc[alive.size()][now+first], f[i]-x[i]*alive.size());
                                                                                                    ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from popeala.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: candidate: template<class _Tp> _Tp std::min(std::initializer_list<_Tp>)
     min(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
popeala.cpp:56:100: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
                 nc[alive.size()][now+first]=min(nc[alive.size()][now+first], f[i]-x[i]*alive.size());
                                                                                                    ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from popeala.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: candidate: template<class _Tp, class _Compare> _Tp std::min(std::initializer_list<_Tp>, _Compare)
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
popeala.cpp:56:100: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
                 nc[alive.size()][now+first]=min(nc[alive.size()][now+first], f[i]-x[i]*alive.size());
                                                                                                    ^
popeala.cpp:50:17: warning: unused variable 'cnt' [-Wunused-variable]
             int cnt=n;
                 ^~~