Submission #200298

#TimeUsernameProblemLanguageResultExecution timeMemory
200298BTheroLand of the Rainbow Gold (APIO17_rainbow)C++17
Compilation error
0 ms0 KiB
// Why am I so dumb? :c // chrono::system_clock::now().time_since_epoch().count() #include<bits/stdc++.h> //#include<ext/pb_ds/assoc_container.hpp> //#include<ext/pb_ds/tree_policy.hpp> #define pb push_back #define mp make_pair #define all(x) (x).begin(), (x).end() #define fi first #define se second using namespace std; //using namespace __gnu_pbds; typedef long long ll; typedef pair<int, int> pii; //template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; const int MAXN = (int)1e2 + 5; const int MAXK = (int)1e3 + 5; const ll LINF = (ll)1e15; const int INF = (int)1e9 + 7; int buy[MAXN][MAXK], sell[MAXN][MAXK]; ll dp[MAXN * 2][MAXN][MAXK]; int adj[MAXN][MAXN]; int n, m, k; ll ans; void check() { for (int st = 1; st <= n; ++st) { for (int len = 0; len <= 2 * n; ++len) { for (int i = 1; i <= n; ++i) { for (int j = 0; j <= k; ++j) { dp[len][i][j] = -LINF; } } } dp[0][st][0] = 0; for (int len = 0; len <= 2 * n; ++len) { for (int v = 1; v <= n; ++v) { for (int i = 1; i <= k; ++i) { if (dp[len][v][i] != -LINF) { if (sell[v][i] != -1) { dp[len][v][0] = max(dp[len][v][0], dp[len][v][i] + sell[v][i]); } } } if (dp[len][v][0] != -LINF) { for (int i = 1; i <= k; ++i) { if (buy[v][i] != -1) { dp[len][v][i] = max(dp[len][v][i], dp[len][v][0] - buy[v][i]); } } } for (int i = 0; i <= k; ++i) { if (dp[len][v][i] == -LINF) { continue; } for (int to = 1; to <= n; ++to) { int w = adj[v][to]; if (w != INF && len + w <= 2 * n) { dp[len + w][to][i] = max(dp[len + w][to][i], dp[len][v][i]); } } } } } for (int i = 1; i <= 2 * n; ++i) { ans = max(ans, dp[i][st][0] / i); } } } void solve() { scanf("%d %d %d", &n, &m, &k); for (int i = 1; i <= n; ++i) { for (int j = 1; j <= k; ++j) { scanf("%d %d", &buy[i][j], &sell[i][j]); } } for (int i = 1; i <= n; ++i) { for (int j = 1; j <= n; ++j) { adj[i][j] = INF; } } for (int i = 1; i <= m; ++i) { int u, v, w; scanf("%d %d %d", &u, &v, &w); adj[u][v] = min(adj[u][v], w); } check(); printf("%lld\n", ans); } int main() { int tt = 1; while (tt--) { solve(); } return 0; }

Compilation message (stderr)

rainbow.cpp: In function 'void solve()':
rainbow.cpp:91:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d %d", &n, &m, &k);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
rainbow.cpp:95:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d %d", &buy[i][j], &sell[i][j]);
             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rainbow.cpp:107:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d %d", &u, &v, &w);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/tmp/cca5nfJ2.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccrNjzje.o:rainbow.cpp:(.text.startup+0x0): first defined here
/tmp/cca5nfJ2.o: In function `main':
grader.cpp:(.text.startup+0xcc): undefined reference to `init(int, int, int, int, int, char*)'
grader.cpp:(.text.startup+0x131): undefined reference to `colour(int, int, int, int)'
collect2: error: ld returned 1 exit status