Submission #38613142
Source Code Expand
Copy
// URL#include <iostream>#include <algorithm>#include <vector>using namespace std;#define loop(i, a, b) for (int i = a; i < b; i++)#define pb push_back#define sz sizetypedef long long LL;const char NL = '\n';const char SP = ' ';const char HB[] = "HOBA";const LL LLINF = 9e18;const int IINF = 1e9;vector <vector <int> > g;vector <short> col;int cnt = 0;
// URL #include <iostream> #include <algorithm> #include <vector> using namespace std; #define loop(i, a, b) for (int i = a; i < b; i++) #define pb push_back #define sz size typedef long long LL; const char NL = '\n'; const char SP = ' '; const char HB[] = "HOBA"; const LL LLINF = 9e18; const int IINF = 1e9; vector <vector <int> > g; vector <short> col; int cnt = 0; void dfs(int cur, int prev) { col[cur] = 1; // cerr << cur << NL; for (int &next : g[cur]) { if (next != prev && col[next] == 1) { // cerr << prev << SP << cur << SP << next << NL; cnt++; } if (col[next] == 0) { dfs(next, cur); } } col[cur] = 2; } int main() { ios_base::sync_with_stdio(false); int n, m; cin >> n >> m; g.resize(n); col.resize(n, 0); while (m--) { int a, b; cin >> a >> b; a--; b--; g[a].pb(b); g[b].pb(a); } loop (i, 0, n) { if (col[i] == 0) { dfs(i, -1); } } cout << cnt << NL; return 0; } /* SAMPLE */
Submission Info
Submission Time | |
---|---|
Task | C - Don’t be cycle |
User | kanapinan |
Language | C++ (Clang 10.0.0) |
Score | 300 |
Code Size | 1041 Byte |
Status | AC |
Exec Time | 318 ms |
Memory | 23260 KB |
Compile Error
./Main.cpp:12:12: warning: unused variable 'SP' [-Wunused-const-variable] const char SP = ' '; ^ ./Main.cpp:13:12: warning: unused variable 'HB' [-Wunused-const-variable] const char HB[] = "HOBA"; ^ ./Main.cpp:14:10: warning: unused variable 'LLINF' [-Wunused-const-variable] const LL LLINF = 9e18; ^ ./Main.cpp:15:11: warning: unused variable 'IINF' [-Wunused-const-variable] const int IINF = 1e9; ^ 4 warnings generated.
Judge Result
Set Name | Sample | All | ||
---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||
Status | AC |
|
Set Name | Test Cases |
---|---|
Sample | |
All | sample00.txt, sample01.txt, sample02.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt, testcase11.txt, testcase12.txt, testcase13.txt, testcase14.txt, testcase15.txt, testcase16.txt, testcase17.txt, testcase18.txt, testcase19.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample00.txt | AC | 14 ms | 3048 KB |
sample01.txt | AC | 4 ms | 2948 KB |
sample02.txt | AC | 2 ms | 2952 KB |
testcase00.txt | AC | 10 ms | 7656 KB |
testcase01.txt | AC | 164 ms | 5572 KB |
testcase02.txt | AC | 186 ms | 6112 KB |
testcase03.txt | AC | 298 ms | 23260 KB |
testcase04.txt | AC | 286 ms | 14200 KB |
testcase05.txt | AC | 223 ms | 9188 KB |
testcase06.txt | AC | 221 ms | 9068 KB |
testcase07.txt | AC | 276 ms | 14292 KB |
testcase08.txt | AC | 275 ms | 14376 KB |
testcase09.txt | AC | 289 ms | 14148 KB |
testcase10.txt | AC | 293 ms | 14308 KB |
testcase11.txt | AC | 283 ms | 13992 KB |
testcase12.txt | AC | 288 ms | 13932 KB |
testcase13.txt | AC | 290 ms | 13896 KB |
testcase14.txt | AC | 290 ms | 14024 KB |
testcase15.txt | AC | 299 ms | 15600 KB |
testcase16.txt | AC | 297 ms | 15688 KB |
testcase17.txt | AC | 318 ms | 15876 KB |
testcase18.txt | AC | 315 ms | 15932 KB |
testcase19.txt | AC | 300 ms | 15844 KB |