Submission #1115642

#TimeUsernameProblemLanguageResultExecution timeMemory
1115642EfeBabagilTrains (BOI24_trains)C++14
8 / 100
2027 ms1104 KiB
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl, C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog. Code, Compile, Run and Debug online from anywhere in world. *******************************************************************************/ #include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { int n; cin>>n; vector<pair<int,int>> city(n); for(int i=0;i<n;i++) { int a,b; cin>>a>>b; city[i]={a,b}; } int ans=0; for(int i=0;i<1<<(n-1);i++) { int last=0; int flag=1; for(int j=0;j<n-1;j++) { int d=city[last].first; int x=city[last].second; if((i>>j)%2) { if(d!=0 && !((j+1-last)%d) && (j+1-last)/d<=x && (j+1-last)/d>=1 ) last=j+1; else flag=0; } } if(flag) ans++; } cout<<ans; return 0; }
#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...