Submission #887320

#TimeUsernameProblemLanguageResultExecution timeMemory
887320HossamHero7Passport (JOI23_passport)C++14
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define endl '\n' void solve(){ int n; cin>>n; vector<pair<int,int>> v(n); for(auto &[a,b] : v) cin>>a>>b , a -- , b--; int q; cin>>q; while(q--){ int x; cin>>x; x --; queue<pair<int,int>> q; q.push({x,x}); vector<vector<int>> dep(n,vector<int>(n)); vector<vector<bool>> vis(n,vector<bool>(n)); vis[x][x] = 1; while(q.size()){ auto [l,r] = q.front(); q.pop(); for(int i=l;i<=r;i++){ int L = min(l,v[i].first); int R = max(r , v[i].second); if(vis[L][R]) continue; q.push({L,R}); vis[L][R] = 1; dep[L][R] = dep[l][r] + 1; } } cout<<dep[0][n-1]<<endl; } } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t=1; //cin>>t; while(t--){ solve(); } return 0; }

Compilation message (stderr)

passport.cpp: In function 'void solve()':
passport.cpp:9:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
    9 |     for(auto &[a,b] : v) cin>>a>>b , a -- , b--;
      |               ^
passport.cpp:22:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   22 |             auto [l,r] = q.front();      q.pop();
      |                  ^
#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...