Submission #1073703

#TimeUsernameProblemLanguageResultExecution timeMemory
1073703Dan4LifeFriend (IOI14_friend)C++17
100 / 100
17 ms2756 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; int findSample(int n, int c[], int h[], int p[]){ int ans = 0, i; // Mind-blown! for(int i = n; i>0; i--){ if(p[i]==2) c[h[i]]=max(c[h[i]],c[i]); else if(p[i]==1) c[h[i]]+=c[i]; else ans+=c[i], c[h[i]]=max(0, c[h[i]]-c[i]); } return c[0]+ans; }

Compilation message (stderr)

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:5:18: warning: unused variable 'i' [-Wunused-variable]
    5 |     int ans = 0, i; // Mind-blown!
      |                  ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...