#include "split.h"
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const int nmax=1e5+50;
const int mod=1e9+7;
using namespace std;
int n,m,i,j,t,a[5],rs[nmax],x,p;
vector<int>vc,g[nmax];
vector<int> find_split(int N, int A, int B, int C, vector<int> P, vector<int> Q)
{
n=N,a[1]=A,a[2]=B,a[3]=C,m=P.size();
for(i=0;i<m;i++)
{
P[i]++,Q[i]++;
g[P[i]].pb(Q[i]);
g[Q[i]].pb(P[i]);
}
for(i=1;i<=n;i++)if(g[i].size()==1)break;
x=i,p=0,t=1;
for(i=1;i<=n;i++)
{
while(!a[t])t++;
rs[x]=t;
a[t]--;
for(j=0;j<g[x].size();j++)
{
if(g[x][j]!=p)
{
p=x;
x=g[x][j];
break;
}
}
}
for(i=1;i<=n;i++)vc.pb(rs[i]);
return vc;
}
Compilation message
split.cpp:3:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
#pragma GCC optimization("O3")
split.cpp:4:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
#pragma GCC optimization("unroll-loops")
split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:40:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(j=0;j<g[x].size();j++)
~^~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
2680 KB |
ok, correct split |
2 |
Incorrect |
4 ms |
2680 KB |
jury found a solution, contestant did not |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
2680 KB |
ok, correct split |
2 |
Incorrect |
4 ms |
2680 KB |
jury found a solution, contestant did not |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
2684 KB |
answer contains both zero and positive values |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
2680 KB |
answer contains both zero and positive values |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
2680 KB |
ok, correct split |
2 |
Incorrect |
4 ms |
2680 KB |
jury found a solution, contestant did not |
3 |
Halted |
0 ms |
0 KB |
- |