This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "speedrun.h"
#include <iostream>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iterator>
#include <limits>
#include <list>
#include <cstring>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <unordered_map>
using namespace std;
typedef int ll;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;
#ifdef px
#define p(x) cerr<<#x<<' '<<x<<endl;
#else
#define p(x) {}
#endif
#define F first
#define S second
#define sz size
#define ls s,m,idx<<1
#define rs m+1,e,idx<<1|1
const ll MOD=ll(1e9)+7;
const ll MAXN=2*ll(1e6);
ll Adj[1001][1001]={};
void assignHints(int subtask, int N, int A[], int B[]) {
setHintLen(N);
for(ll i=1;i<N;i++){
//cout<<A[i]<<"--->"<<B[i]<<endl;
Adj[A[i]][B[i]]=1;
Adj[B[i]][A[i]]=1;
setHint(A[i],B[i]-1,1);
setHint(B[i],A[i]-1,1);
}
for(ll i=1;i<=N;i++){
for(ll j=i;j<=N;j++){
if(!Adj[i][j]){
setHint(i,j-1,0);
setHint(j,i-1,0);
}
}
}
}
vi V;
void dfs(ll s,ll p=-1){
//cerr<<V.size()<<endl;
V[s]=1;
for(ll i=1;i<V.size();i++){
//cout<<s<<'-'<<i<<endl;
//cout<<Adj[s][i]<<endl;
if(!V[i]&&getHint(i-1)==1){
//cout<<s<<'-'<<i<<endl;
goTo(i);
dfs(i,s);
}
}
goTo(p);
}
void speedrun(int subtask, int N, int start) { /* your solution here */
V.assign(N+1,0);
dfs(start);
}
Compilation message (stderr)
speedrun.cpp: In function 'void dfs(ll, ll)':
speedrun.cpp:62:17: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
62 | for(ll i=1;i<V.size();i++){
| ~^~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |