Submission #1255051

#TimeUsernameProblemLanguageResultExecution timeMemory
1255051tosivanmakMigrations (IOI25_migrations)C++20
Compilation error
0 ms0 KiB
#include "migrations.h" #include<bits/stdc++.h> using namespace std; #define ll int ll dep[10005]; ll maxdep=0; ll nd; vector<ll>bt; // N-i<=19 // 10000 9981 // 9981 to 9999 19 information int send_message(int N, int i, int Pi) { dep[0]=0; dep[i]=dep[Pi]+1; if(dep[i]>maxdep){ maxdep=dep[i]; nd=i; } if(N-i>=20)return 0; if(N-i==19){ if(nd==i)return 3; for(int i=18;i>=0;i--){ if(nd&(1LL<<i))bt.push_back(2); else bt.push_back(1); } // 0 18 return bt[N-i-1]; } else{ if(nd==i)return 3; else if(N-nd<=19)return 0; return bt[N-i-1]; } } std::pair<int, int> longest_path(std::vector<int> S) { for(int i=9999;i>=1;i--){ if(S[i]==3){ return {0,S[i]}; } } ll tk=0; for(int i=N-19;i<=9999;i++){ ll ans=(1LL<<(N-i-1))*(S[i]-1); tk+=ans; } return {0,tk}; }

Compilation message (stderr)

migrations.cpp: In function 'std::pair<int, int> longest_path(std::vector<int>)':
migrations.cpp:42:15: error: 'N' was not declared in this scope
   42 |     for(int i=N-19;i<=9999;i++){
      |               ^