Submission #996626

#TimeUsernameProblemLanguageResultExecution timeMemory
9966268pete8Speedrun (RMI21_speedrun)C++17
0 / 100
1 ms344 KiB
/* I love you you love me MIXUE Ice cream and tea I love you you love me MIXUE Ice cream and tea I love you you love me I love you you love me MIXUE Ice cream and tea */ #include "speedrun.h" #include<iostream> #include<stack> #include<map> #include<vector> #include<string> #include<cassert> #include<unordered_map> #include <queue> #include <cstdint> #include<cstring> #include<limits.h> #include<cmath> #include<set> #include<algorithm> #include <iomanip> #include<numeric> #include<bitset> using namespace std; #define ll long long #define f first #define s second #define pii pair<int,int> #define ppii pair<int,pii> #define vi vector<int> #define pb push_back #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define F(n) for(int i=0;i<n;i++) #define lb lower_bound #define ub upper_bound #define fastio ios::sync_with_stdio(false);cin.tie(NULL); #pragma GCC optimize ("03,unroll-lopps") vector<int>adj[1001]; int up[1001],go[1001]; int dfs(int cur,int p){ int last=cur; for(auto i:adj[cur]){ if(i==p)continue; go[last]=i; up[i]=cur; last=dfs(i,cur); } return last; } void assignHints(int subtask, int N, int A[], int B[]){ for(int i=1;i<N;i++){ adj[A[i]].pb(B[i]); adj[B[i]].pb(A[i]); } setHintLen(20); dfs(1,-1); for(int i=1;i<=N;i++){ int x=up[i]; for(int j=0;j<10;j++)setHint(i,j,(x&(1LL<<j))); x=go[i]; for(int j=0;j<10;j++)setHint(i,j+10,(x&(1LL<<j))); } return; //go left and comeback } void speedrun(int subtask, int N, int start){ vector<int>up(N+1,0),go(N+1,0); auto get=[&](int st){ int val=0; for(int j=0;j<10;j++)if(getHint(j+st))val+=((1LL<<j)); return val; }; int cur=start; while(cur!=1){ if(cur==0)break; up[cur]=get(0); goTo(up[cur]); cur=up[cur]; } stack<int>st; while(1){ st.push(cur); int nx=get(10); if(nx==0)break; while(!goTo(nx))st.pop(),goTo(st.top()); cur=nx; } } /* 5 1 2 2 3 3 4 3 5 */

Compilation message (stderr)

speedrun.cpp:42:40: warning: bad option '-funroll-lopps' to pragma 'optimize' [-Wpragmas]
   42 | #pragma GCC optimize ("03,unroll-lopps")
      |                                        ^
speedrun.cpp:45:22: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   45 | int dfs(int cur,int p){
      |                      ^
speedrun.cpp:55:54: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   55 | void assignHints(int subtask, int N, int A[], int B[]){
      |                                                      ^
speedrun.cpp:71:44: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   71 | void speedrun(int subtask, int N, int start){
      |                                            ^
speedrun.cpp: In function 'void speedrun(int, int, int)':
speedrun.cpp:73:24: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   73 |     auto get=[&](int st){
      |                        ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...