Submission #88869

#TimeUsernameProblemLanguageResultExecution timeMemory
88869mchTriumphal arch (POI13_luk)C++14
0 / 100
197 ms13532 KiB
#include <iostream> #include <vector> #include <algorithm> #include <list> using namespace std; bool isEnough(int nCrew, vector<int> arr[], int n){ int max = arr[n].size(); int left = nCrew - max; // printf("%d %d %d\n", max, left, nCrew); if(left < 0) return false; for(int i = 0; i < max; i++){ int k = arr[n][i]; // printf("%d\n", k); if(!isEnough(nCrew+left, arr, k)) return false; } return true; } int main(){ vector<int> arr[300001]; int n, from, to; scanf("%d", &n); for(int i = 0; i < n-1; i++){ scanf("%d", &from); scanf("%d", &to); arr[min(from-1, to-1)].push_back(max(from-1, to-1)); } int low = 0; int high = n-1; while(low <= high){ int mid = (low + high)/2; if(isEnough(mid, arr, 0)) high = mid - 1; else low = mid + 1; } printf("%d", low); return 0; }

Compilation message (stderr)

luk.cpp: In function 'int main()':
luk.cpp:26:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
luk.cpp:30:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &from);
         ~~~~~^~~~~~~~~~~~~
luk.cpp:31:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &to);
         ~~~~~^~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...