Submission #244696

#TimeUsernameProblemLanguageResultExecution timeMemory
244696TheLoraxPolitical Development (BOI17_politicaldevelopment)C++11
16 / 100
163 ms4600 KiB
#include <bits/stdc++.h> //#pragma GCC optimize ("O3") //#pragma GCC optimize ("Ofast") #define F first #define S second #define MT make_tuple #define MP make_pair #define SZ(a) ((int)(a).size()) #define PB push_back #define LEFT(i) (2*(i)) #define RIGHT(i) (2*(i)+1) #define PAR(i) ((i)/2) #define ALL(a) (a).begin(), (a).end() #define END(s) {cout << s;return;} using namespace std; typedef long long ll; typedef pair<ll, ll> ii; int n; std::vector<std::vector<int> > e; void rek(int a, int f, int s){ for(auto x: e[a]){ if(x==s){ printf("3\n"); exit(0); } if(x==f) continue; if(s==-1) rek(x, a, f); } } int main(){ int k; scanf("%d %d", &n, &k); e.resize(n); for(int i=0; i<n; i++){ int d; scanf("%d", &d); for(int j=0; j<d; j++){ int t; scanf("%d", &t); e[i].PB(t); } } //k<=3 for(int i=0; i<n; i++) rek(i, -1, -1); //k<=2 for(int i=0; i<n; i++) if(SZ(e[i])){ printf("2\n"); return 0; } //k<=1 printf("1\n"); }

Compilation message (stderr)

politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:40:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &n, &k);
   ~~~~~^~~~~~~~~~~~~~~~~
politicaldevelopment.cpp:43:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int d; scanf("%d", &d);
            ~~~~~^~~~~~~~~~
politicaldevelopment.cpp:46:12: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
       scanf("%d", &t);
       ~~~~~^~~~~~~~~~
#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...