Submission #943849

# Submission time Handle Problem Language Result Execution time Memory
943849 2024-03-12T02:29:34 Z thunopro Speedrun (RMI21_speedrun) C++14
100 / 100
72 ms 2132 KB
#include<bits/stdc++.h>
using namespace std ; 
#define maxn 1009
#define ll long long 
#define pb push_back 
#define fi first 
#define se second 
#define left id<<1
#define right id<<1|1 
#define re exit(0); 
#define _lower(x) lower_bound(v.begin(),v.end(),x)-v.begin()+1 
#define TIME ( 1.0*clock() / CLOCKS_PER_SEC )
const int mod = 1e9+7 ;
const int INF = 1e9 ; 

typedef vector<int> vi ; 
typedef pair<int,int> pii ; 
typedef vector<pii> vii ; 

template < typename T > void chkmin ( T &a , T b ) { if ( a > b ) a = b ; } 
template < typename T > void chkmax ( T &a , T b ) { if ( a < b ) a = b ; } 

void add ( int &a , int b ) 
{
	a += b ; 
	if ( a >= mod ) a -= mod ; 
	if ( a < 0 ) a += mod ; 
}

void rf () 
{
	freopen ("bai1.inp","r",stdin) ;
}

mt19937 rng (time(0)) ; 

int _pow ( int a , int n ) 
{
	if ( n == 0 ) return 1 ; 
	int res = _pow (a,n/2) ; 
	if ( n % 2 ) return 1ll*res*res%mod*a%mod ; 
	else return 1ll*res*res%mod ; 
}

#include "speedrun.h"

vi adjList [maxn] ; 
int par [maxn] ; 
int euler [maxn] , timeDfs ; 

void dfs ( int u , int dfs_par = 0 ) 
{
	par [u] = dfs_par ; 
	euler [timeDfs++] = u ; 
	for ( auto v : adjList [u] ) 
	{
		if ( v != dfs_par ) 
		{
			dfs (v,u) ; 
		}
	}	
}

void setInterger ( int node , int id , int value ) 
{
	int offset = id*10+1 ; 
	for ( int b = 0 ; b < 10 ; b ++ ) 
	{
		if ( value>>b&1 ) setHint (node,offset+b,true) ; 
	}
}

void assignHints ( int subtask , int n , int A [], int B [] ) 
{
	setHintLen (20) ; 
	for ( int i = 1 ; i <= n-1 ; i ++ ) 
	{
		int u = A [i] , v = B [i] ; 
		adjList [u] . pb (v) , adjList [v] . pb (u) ; 
	}
	dfs (1) ; 
	for ( int i = 0 ; i < n ; i ++ ) 
	{
		setInterger (i+1,0,par[i+1]) ; 
		setInterger (euler[i],1,euler[(i+1)%n]) ; 
	}
}

int readInterger ( int id ) 
{
	int offset = id*10+1 ; 
	int value = 0 ; 
	for ( int b = 0 ; b < 10 ; b ++ ) 
	{
		value += (getHint(offset+b)<<b) ; 
	}
	return value ; 
}

void speedrun ( int subtask , int n , int start ) 
{
	int node = start ; 
	do {
		int target = readInterger (1) ; 
		while (!goTo(target)) 
		{
			node = readInterger (0) ; 
			goTo (node) ; 
		}
		node = target ; 
	} while ( node != start ) ; 
}

Compilation message

speedrun.cpp: In function 'void rf()':
speedrun.cpp:32:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |  freopen ("bai1.inp","r",stdin) ;
      |  ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 56 ms 1548 KB Output is correct
2 Correct 56 ms 1376 KB Output is correct
3 Correct 49 ms 1112 KB Output is correct
4 Correct 59 ms 1880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 60 ms 1784 KB Output is correct
2 Correct 52 ms 1288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 54 ms 1372 KB Output is correct
2 Correct 59 ms 1900 KB Output is correct
3 Correct 58 ms 1540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 52 ms 1320 KB Output is correct
2 Correct 72 ms 1892 KB Output is correct
3 Correct 62 ms 1388 KB Output is correct
4 Correct 70 ms 1376 KB Output is correct
5 Correct 60 ms 1364 KB Output is correct
6 Correct 63 ms 2132 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 65 ms 1544 KB Output is correct
2 Correct 62 ms 1536 KB Output is correct
3 Correct 69 ms 1620 KB Output is correct
4 Correct 56 ms 1800 KB Output is correct
5 Correct 65 ms 1880 KB Output is correct
6 Correct 54 ms 1624 KB Output is correct
7 Correct 56 ms 1800 KB Output is correct