Submission #57889

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
578892018-07-16 13:31:54gabrielsimoesChase (CEOI17_chase)C++17
30 / 100
2101 ms256924 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 1e5+10, MAXV = 101;
int n, vMax;
ll p[MAXN];
vector<int> g[MAXN];
int a[MAXN], b[MAXN];
ll dp[MAXN][MAXV][3];
ll f(int curEdge, int v, int dir) {
if (v == 0) return 0;
ll &ret = dp[curEdge][v][dir];
if (ret != -1) return ret;
ret = 0;
int cur, prev;
if (dir == 0) cur = curEdge, prev = -1;
else if (dir == 1) prev = a[curEdge], cur = b[curEdge];
else cur = a[curEdge], prev = b[curEdge];
ll sumAll = 0;
for (int edge : g[cur]) {
int nx = a[edge] == cur ? b[edge] : a[edge];
if (nx != prev) {
sumAll += p[nx];
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

chase.cpp: In function 'int main()':
chase.cpp:50:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &n, &vMax);
     ~~~~~^~~~~~~~~~~~~~~~~~~
chase.cpp:51:39: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for (int i = 1; i <= n; i++) scanf("%lld", &p[i]);
                                  ~~~~~^~~~~~~~~~~~~~~
chase.cpp:53:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d", &a[i], &b[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...