제출 #1073342

#제출 시각아이디문제언어결과실행 시간메모리
1073342ProtonDecay314Text editor (CEOI24_editor)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vll; typedef vector<vll> vvll; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<ll, ll> pll; typedef pair<int, int> pi; typedef vector<bool> vb; #define fi first #define se second #define IOS cin.tie(nullptr); cout.tie(nullptr); ios_base::sync_with_stdio(false) ll solve(ll n, ll sl, ll sc, ll el, ll ec, const vll& l) { vll prefl(n + 1ll, 0ll); for(ll i = 0ll; i < n; i++) { prefl[i + 1ll] = prefl[i] + l[i]; } ll totn = prefl[n]; vvll adj; for(ll i = 0ll; i < totn; i++) { vll adjr; adj.pb(adjr); } ll s = prefl[sl] + sc, e = prefl[el] + ec; for(ll li = 0ll; li < n; li++) { for(ll ci = 0ll; ci < l[li]; ci++) { ll ni = prefl[li] + ci; ll adji; // up if(li > 0ll) { adji = prefl[li - 1ll] + min(ci, l[li - 1ll] - 1ll); adj[ni].pb(adji); } // down if(li < n - 1ll) { adji = prefl[li + 1ll] + min(ci, l[li + 1ll] - 1ll); adj[ni].pb(adji); } // left if(li > 0ll || ci > 0ll) { adji = ni - 1ll; adj[ni].pb(adji); } // right if(li < n - 1ll) { adji = ni + 1ll; adj[ni].pb(adji); } } } // Performing BFS vb vis(totn, false); queue<pll> q; q.push({s, 0ll}); ll ans = 0ll; while(!q.empty()) { auto [curn, dist] = q.front(); if(vis[curn]) continue; vis[curn] = true; if(curn == e) { ans = dist; break; } for(ll j : adj[i]) { q.push({j, dist + 1ll}); } } return ans; } int main() { IOS; ll n; cin >> n; ll sl, sc; ll el, ec; cin >> sl >> sc; cin >> el >> ec; sl--; sc--; el--; ec--; vll l(n, 0ll); for(ll& lv : l) { cin >> lv; lv++; // ! WARNING, already added one } cout << solve(n, sl, sc, el, ec, l) << endl; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'll solve(ll, ll, ll, ll, ll, const vll&)':
Main.cpp:28:13: error: 'vvll' {aka 'class std::vector<std::vector<long long int> >'} has no member named 'pb'
   28 |         adj.pb(adjr);
      |             ^~
Main.cpp:42:25: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'class std::vector<long long int>'} has no member named 'pb'
   42 |                 adj[ni].pb(adji);
      |                         ^~
Main.cpp:48:25: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'class std::vector<long long int>'} has no member named 'pb'
   48 |                 adj[ni].pb(adji);
      |                         ^~
Main.cpp:54:25: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'class std::vector<long long int>'} has no member named 'pb'
   54 |                 adj[ni].pb(adji);
      |                         ^~
Main.cpp:60:25: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'class std::vector<long long int>'} has no member named 'pb'
   60 |                 adj[ni].pb(adji);
      |                         ^~
Main.cpp:85:24: error: 'i' was not declared in this scope
   85 |         for(ll j : adj[i]) {
      |                        ^