#include "Alicelib.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
void Alice( int n, int m, int A[], int B[] ){
vector<pii> v;
for (int i=0; i<n; ++i) v.push_back({n,i});
for (int i=n+1; i<=n+11; ++i) v.push_back({i-1,i});
for (int i=0; i<n; ++i) {
for (int j=0; j<10; ++j) {
if (i&(1<<j)) v.push_back({i,n+2+j});
}
}
for (int i=0; i<m; ++i) v.push_back({A[i],B[i]});
InitG(n+12,v.size());
for (int i=0; i<v.size(); ++i) MakeG(i,v[i].first,v[i].second);
}
#include "Boblib.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
int st,nx,re[1020];
vector<int> adj[1020];
bool mark[1020];
void dfs(int x, int par, int val) {
int nxt=-1;
for (auto s : adj[x]) {
if (s==par) continue;
if (mark[s]) re[s]+=val;
else nxt=s;
}
if (nxt!=-1) dfs(nxt,x,val*2);
}
void Bob(int n, int m, int C[], int D[] ){
vector<pii> v;
for (int i=0; i<m; ++i) {
adj[C[i]].push_back(D[i]);
adj[D[i]].push_back(C[i]);
}
for (int i=0; i<n; ++i) if (adj[i].size()==n-11) st=i;
for (auto s : adj[st]) mark[s]=true;
int cnt=0;
for (auto s : adj[st]) {
if (adj[s].size()==1) continue;
mark[s]=false;
for (auto k : adj[s]) mark[s]|=mark[k];
if (!mark[s]) nx=s, ++cnt;
}
assert(cnt==1);
for (auto s : adj[nx]) {
if (s!=st) dfs(s,nx,1);
}
for (int i=0; i<m; ++i) {
if (mark[C[i]] && mark[D[i]]) {
v.push_back({re[C[i]],re[D[i]]});
}
}
InitMap(n-12,v.size());
for (auto s : v) MakeMap(s.first,s.second);
}
Compilation message
Alice.cpp: In function 'void Alice(int, int, int*, int*)':
Alice.cpp:17:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
17 | for (int i=0; i<v.size(); ++i) MakeG(i,v[i].first,v[i].second);
| ~^~~~~~~~~
Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:26:43: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
26 | for (int i=0; i<n; ++i) if (adj[i].size()==n-11) st=i;
| ~~~~~~~~~~~~~^~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
3 ms |
5892 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
3 ms |
5892 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
357 ms |
34780 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |