Submission #45971

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
459712018-04-16 17:11:41minhtung0404Easter Eggs (info1cup17_eastereggs)C++17
100 / 100
25 ms2952 KiB
//https://oj.uz/problem/view/info1cup17_eastereggs
#include <bits/stdc++.h>
#include "grader.h"
const int N = 1e5 + 5;
using namespace std;
typedef pair <int, int> ii;
typedef vector <int> vi;
vi adj[N], ans;
int n, num, cur, cnt;
bool ck[N], nw[N];
void dfs(int u, int p){
if (cur == num) return;
if (ck[u]) cur++;
ans.push_back(u);
for (int i = 0; i < adj[u].size(); i++){
int v = adj[u][i];
if (v == p) continue;
dfs(v, u);
}
}
int findEgg (int N, vector <ii> bridges) {
n = N;
for (int i = 1; i <= n; i++) ck[i] = 1; cnt = n;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

eastereggs.cpp: In function 'void dfs(int, int)':
eastereggs.cpp:21:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < adj[u].size(); i++){
                     ~~^~~~~~~~~~~~~~~
eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:30:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
     for (int i = 1; i <= n; i++) ck[i] = 1; cnt = n;
     ^~~
eastereggs.cpp:30:45: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
     for (int i = 1; i <= n; i++) ck[i] = 1; cnt = n;
                                             ^~~
eastereggs.cpp:42:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (int i = 0; i < ans.size(); i++) nw[ans[i]] = ck[ans[i]];
                             ~~^~~~~~~~~~~~
eastereggs.cpp:47:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (int i = 0; i < ans.size(); i++) ck[ans[i]] = 0;
                             ~~^~~~~~~~~~~~
eastereggs.cpp:52:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...