Submission #1102018

#TimeUsernameProblemLanguageResultExecution timeMemory
1102018Mo_co_giai_VNOINile (IOI24_nile)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #define maxn 1000000 #define INF LONG_MAX #define inf 2e18 #define fo(i,x,y) for (ll i=x;i<=y;i++) #define Fo(i,x,y,c) for (int i=x;i<=y;i+=c) #define fo_re(i,x,y) for (int i=x;i>=y;i--) #define Fo_re(i,x,y,c) for (int i=x;i>=y;i-=c) #define task "LOVE" #define fast ios_base::sync_with_stdio(0); cin.tie(); cout.tie(); #define file_init freopen(task".INP","r",stdin); freopen(task".OUT","w",stdout); #define ll long long #define str string #define bo bool #define vec vector #define pa pair #define pll pa<ll,ll> #define all(x) x.begin(), x.end() #define fi first #define se second #define pb push_back #define el '\n' // "PRACTICE MAKES PERFECT" // // - Presented by KHANH NGUYEN - THD High School for the gifted - // using namespace std; const ll MOD = 1e9+7; struct BURU_AKAIBU { ll w, a, b; }; BURU_AKAIBU s[maxn]; ll n, q, cnt, res = INF; ll x[maxn]; void Try(int i, ll d){ fo(j,1,2){ x[i] = j; if (x[i-1] == 0) x[i] = 0; if (i == n){ cnt = 0; fo(t,1,n) if(x[t] == 1) cnt+=s[t].a; else if (x[t] == 2) if (abs(s[t].w - s[t+1].w) <= d) cnt+=min(s[t].a + s[t+1].a, s[t].b + s[t+1].b); else cnt+=s[t].a+s[t+1].a; res = min(res, cnt); } else Try(i+1, d); } } signed main () { fast; cin>>n; fo(i,1,n){ ll w, a, b; cin>>w>>a>>b; BURU_AKAIBU B; B.a = a; B.b = b; B.w = w; s[i] = B; } //cout<<"OK"<<el; cin>>q; while(q--){ res = INF; ll y; cin>>y; Try(1, y); cout<<res<<el; } return 0; }

Compilation message (stderr)

nile.cpp: In function 'void Try(int, long long int)':
nile.cpp:49:25: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
   49 |                 else if (x[t] == 2)
      |                         ^
/usr/bin/ld: /tmp/ccsDYMP6.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccPuZwU8.o:nile.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccsDYMP6.o: in function `main':
grader.cpp:(.text.startup+0x300): undefined reference to `calculate_costs(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status