제출 #1318554

#제출 시각아이디문제언어결과실행 시간메모리
1318554g31niusEaster Eggs (info1cup17_eastereggs)C++20
컴파일 에러
0 ms0 KiB
#include <iostream> #include <vector> #include <queue> using namespace std; int cnt, ap[1009], i, n, x, q, y; vector <int> v[1009]; int query ( vector <int> h ) { cnt++; if ( h.empty() ) { return 0; } for ( i = 1; i <= n; i++ ) { ap[i] = 0; } for ( auto it = h.begin(); it != h.end(); it++ ) { ap[*it] = 1; } queue <int> cc; cc.push ( h[0] ); ap[h[0]] = 2; while ( !cc.empty() ) { int nod = cc.front(); cc.pop(); for ( auto it = v[nod].begin(); it != v[nod].end(); it++ ) { if ( ap[*it] == 1 ) { ap[*it] = 2; cc.push ( *it ); } } } for ( i = 1; i <= n; i++ ) { if ( ap[i] == 1 ) { return -1; } } for ( auto it: h ) { if ( it == x ) { return 1; } } return 0; } int findEgg ( int n, vector < pair <int, int> > bridges ) { if ( query ( {1} ) == 1 ) { return 1; } return 0; } int main() { vector < pair <int, int> > param; q = 0; cin >> n; for ( i = 1; i < n; i++ ) { cin >> x >> y; v[x].push_back(y); v[y].push_back(x); param.push_back ( { x,y } ); } cin >> q; while ( q > 0 ) { cin >> x; cnt = 0; y = findEgg ( n, param ); if ( x != y ) { cout << "WA\n"; } else { cout << "OK " << cnt << '\n'; } q--; } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

/usr/bin/ld: /tmp/ccI6OPbN.o: in function `query(std::vector<int, std::allocator<int> >)':
grader.cpp:(.text+0x0): multiple definition of `query(std::vector<int, std::allocator<int> >)'; /tmp/ccPJ3mow.o:eastereggs.cpp:(.text+0x50): first defined here
/usr/bin/ld: /tmp/ccI6OPbN.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccPJ3mow.o:eastereggs.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status