제출 #1030163

#제출 시각아이디문제언어결과실행 시간메모리
1030163SamuellH12Bitaro’s Party (JOI18_bitaro)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define optimize ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL) #define ALL(x) x.begin(), x.end() #define endl "\n" #define vi vector<int> #define pii pair<int,int> const int MAXN = 1e5 + 5; const int SQRT = 200; using namespace std; #define int ll int block[MAXN], dp[MAXN], tempo; vi trafo[MAXN], order; vector<pii> best[MAXN]; void get_order(int n){ queue<int> fila; for(int i=1; i<=n; i++) if(dp[i] == 0) fila.emplace(i); while(!fila.empty()) { auto u = fila.front(); fila.pop(); order.emplace_back(u); for(auto v : trafo[u]) if(--dp[v] == 0) fila.emplace(v); } reverse(ALL(order)); } void precalc(){ for(auto u : order) { best[u].emplace_back(0, u); for(auto v : trafo[u]) { // best[u].emplace_back(-1, v); for(auto [x, w] : best[v]) if(best[u].back() != pii(x-1, w)) best[u].emplace_back(x-1, w); if(best[u].size() > 2*SQRT) { sort(ALL(best[u])); best[u].resize(SQRT); } } sort(ALL(best[u])); if(best[u].size() > SQRT) best[u].resize(SQRT); } } int solve(int w){ for(auto u : order) { dp[u] = (block[u] == tempo ? -1 : 0); for(auto v : trafo[u]) if(~dp[v]) dp[u] = max(dp[u], dp[v]+1); if(u == w) return dp[u]; } assert(false); return dp[w]; } int32_t main(){ optimize; int n, m, q; cin >> n >> m >> q; for(int i=0, u, v; i<m; i++) { cin >> u >> v; trafo[v].emplace_back(u); dp[u]++; } get_order(n); precalc(); int t, y; while(q--) { tempo++; cin >> t >> y; for(int i=0, x; i<y; i++) cin >> x, block[x] = tempo; int ans = -100; for(auto [x, w] : best[t]) if(block[w] != tempo) { ans = -x; break; } if(ans == -100) ans = solve(t); cout << ans << endl; } return 0; }

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

bitaro.cpp:10:13: error: 'll' does not name a type
   10 | #define int ll
      |             ^~
bitaro.cpp:12:1: note: in expansion of macro 'int'
   12 | int block[MAXN], dp[MAXN], tempo;
      | ^~~
bitaro.cpp:10:13: error: 'll' was not declared in this scope
   10 | #define int ll
      |             ^~
bitaro.cpp:5:19: note: in expansion of macro 'int'
    5 | #define vi vector<int>
      |                   ^~~
bitaro.cpp:13:1: note: in expansion of macro 'vi'
   13 | vi trafo[MAXN], order;
      | ^~
bitaro.cpp:5:22: error: template argument 1 is invalid
    5 | #define vi vector<int>
      |                      ^
bitaro.cpp:13:1: note: in expansion of macro 'vi'
   13 | vi trafo[MAXN], order;
      | ^~
bitaro.cpp:5:22: error: template argument 2 is invalid
    5 | #define vi vector<int>
      |                      ^
bitaro.cpp:13:1: note: in expansion of macro 'vi'
   13 | vi trafo[MAXN], order;
      | ^~
bitaro.cpp:10:13: error: 'll' was not declared in this scope
   10 | #define int ll
      |             ^~
bitaro.cpp:6:18: note: in expansion of macro 'int'
    6 | #define pii pair<int,int>
      |                  ^~~
bitaro.cpp:14:8: note: in expansion of macro 'pii'
   14 | vector<pii> best[MAXN];
      |        ^~~
bitaro.cpp:10:13: error: 'll' was not declared in this scope
   10 | #define int ll
      |             ^~
bitaro.cpp:6:22: note: in expansion of macro 'int'
    6 | #define pii pair<int,int>
      |                      ^~~
bitaro.cpp:14:8: note: in expansion of macro 'pii'
   14 | vector<pii> best[MAXN];
      |        ^~~
bitaro.cpp:6:25: error: template argument 1 is invalid
    6 | #define pii pair<int,int>
      |                         ^
bitaro.cpp:14:8: note: in expansion of macro 'pii'
   14 | vector<pii> best[MAXN];
      |        ^~~
bitaro.cpp:6:25: error: template argument 2 is invalid
    6 | #define pii pair<int,int>
      |                         ^
bitaro.cpp:14:8: note: in expansion of macro 'pii'
   14 | vector<pii> best[MAXN];
      |        ^~~
bitaro.cpp:14:11: error: template argument 1 is invalid
   14 | vector<pii> best[MAXN];
      |           ^
bitaro.cpp:14:11: error: template argument 2 is invalid
bitaro.cpp:16:6: error: variable or field 'get_order' declared void
   16 | void get_order(int n){
      |      ^~~~~~~~~
bitaro.cpp:10:13: error: 'll' was not declared in this scope
   10 | #define int ll
      |             ^~
bitaro.cpp:16:16: note: in expansion of macro 'int'
   16 | void get_order(int n){
      |                ^~~
bitaro.cpp: In function 'void precalc()':
bitaro.cpp:37:15: error: 'begin' was not declared in this scope
   37 |  for(auto u : order)
      |               ^~~~~
bitaro.cpp:37:15: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from bitaro.cpp:1:
/usr/include/c++/10/valarray:1224:5: note:   'std::begin'
 1224 |     begin(const valarray<_Tp>& __va)
      |     ^~~~~
In file included from /usr/include/c++/10/filesystem:46,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from bitaro.cpp:1:
/usr/include/c++/10/bits/fs_dir.h:549:3: note:   'std::filesystem::__cxx11::begin'
  549 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
bitaro.cpp:37:15: error: 'end' was not declared in this scope
   37 |  for(auto u : order)
      |               ^~~~~
bitaro.cpp:37:15: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from bitaro.cpp:1:
/usr/include/c++/10/valarray:1244:5: note:   'std::end'
 1244 |     end(const valarray<_Tp>& __va)
      |     ^~~
In file included from /usr/include/c++/10/filesystem:46,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from bitaro.cpp:1:
/usr/include/c++/10/bits/fs_dir.h:554:3: note:   'std::filesystem::__cxx11::end'
  554 |   end(recursive_directory_iterator) noexcept
      |   ^~~
bitaro.cpp:10:13: error: 'll' was not declared in this scope
   10 | #define int ll
      |             ^~
bitaro.cpp:6:18: note: in expansion of macro 'int'
    6 | #define pii pair<int,int>
      |                  ^~~
bitaro.cpp:45:26: note: in expansion of macro 'pii'
   45 |     if(best[u].back() != pii(x-1, w))
      |                          ^~~
bitaro.cpp:6:25: error: template argument 1 is invalid
    6 | #define pii pair<int,int>
      |                         ^
bitaro.cpp:45:26: note: in expansion of macro 'pii'
   45 |     if(best[u].back() != pii(x-1, w))
      |                          ^~~
bitaro.cpp: At global scope:
bitaro.cpp:10:13: error: 'll' does not name a type
   10 | #define int ll
      |             ^~
bitaro.cpp:60:1: note: in expansion of macro 'int'
   60 | int solve(int w){
      | ^~~
bitaro.cpp: In function 'int32_t main()':
bitaro.cpp:10:13: error: 'll' was not declared in this scope
   10 | #define int ll
      |             ^~
bitaro.cpp:78:2: note: in expansion of macro 'int'
   78 |  int n, m, q;
      |  ^~~
bitaro.cpp:79:9: error: 'n' was not declared in this scope; did you mean 'yn'?
   79 |  cin >> n >> m >> q;
      |         ^
      |         yn
bitaro.cpp:79:14: error: 'm' was not declared in this scope; did you mean 'tm'?
   79 |  cin >> n >> m >> q;
      |              ^
      |              tm
bitaro.cpp:79:19: error: 'q' was not declared in this scope
   79 |  cin >> n >> m >> q;
      |                   ^
bitaro.cpp:81:10: error: expected ';' before 'i'
   81 |  for(int i=0, u, v; i<m; i++)
      |          ^
bitaro.cpp:81:21: error: 'i' was not declared in this scope; did you mean 'vi'?
   81 |  for(int i=0, u, v; i<m; i++)
      |                     ^
      |                     vi
bitaro.cpp:83:10: error: 'u' was not declared in this scope
   83 |   cin >> u >> v;
      |          ^
bitaro.cpp:83:15: error: 'v' was not declared in this scope; did you mean 'vi'?
   83 |   cin >> u >> v;
      |               ^
      |               vi
bitaro.cpp:85:3: error: 'dp' was not declared in this scope
   85 |   dp[u]++;
      |   ^~
bitaro.cpp:88:2: error: 'get_order' was not declared in this scope
   88 |  get_order(n);
      |  ^~~~~~~~~
bitaro.cpp:91:6: error: expected ';' before 't'
   91 |  int t, y;
      |      ^
bitaro.cpp:94:3: error: 'tempo' was not declared in this scope
   94 |   tempo++;
      |   ^~~~~
bitaro.cpp:95:10: error: 't' was not declared in this scope; did you mean 'tm'?
   95 |   cin >> t >> y;
      |          ^
      |          tm
bitaro.cpp:95:15: error: 'y' was not declared in this scope; did you mean 'yn'?
   95 |   cin >> t >> y;
      |               ^
      |               yn
bitaro.cpp:97:11: error: expected ';' before 'i'
   97 |   for(int i=0, x; i<y; i++)
      |           ^
bitaro.cpp:97:19: error: 'i' was not declared in this scope; did you mean 'vi'?
   97 |   for(int i=0, x; i<y; i++)
      |                   ^
      |                   vi
bitaro.cpp:98:11: error: 'x' was not declared in this scope
   98 |    cin >> x, block[x] = tempo;
      |           ^
bitaro.cpp:98:14: error: 'block' was not declared in this scope; did you mean 'std::filesystem::file_type::block'?
   98 |    cin >> x, block[x] = tempo;
      |              ^~~~~
      |              std::filesystem::file_type::block
In file included from /usr/include/c++/10/filesystem:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from bitaro.cpp:1:
/usr/include/c++/10/bits/fs_fwd.h:77:7: note: 'std::filesystem::file_type::block' declared here
   77 |       block = 4, character = 5, fifo = 6, socket = 7, unknown = 8
      |       ^~~~~
bitaro.cpp:100:7: error: expected ';' before 'ans'
  100 |   int ans = -100;
      |       ^~~
bitaro.cpp:103:7: error: 'block' was not declared in this scope; did you mean 'std::filesystem::file_type::block'?
  103 |    if(block[w] != tempo)
      |       ^~~~~
      |       std::filesystem::file_type::block
In file included from /usr/include/c++/10/filesystem:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from bitaro.cpp:1:
/usr/include/c++/10/bits/fs_fwd.h:77:7: note: 'std::filesystem::file_type::block' declared here
   77 |       block = 4, character = 5, fifo = 6, socket = 7, unknown = 8
      |       ^~~~~
bitaro.cpp:105:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
  105 |     ans = -x;
      |     ^~~
      |     abs
bitaro.cpp:109:6: error: 'ans' was not declared in this scope; did you mean 'abs'?
  109 |   if(ans == -100) ans = solve(t);
      |      ^~~
      |      abs
bitaro.cpp:109:25: error: 'solve' was not declared in this scope
  109 |   if(ans == -100) ans = solve(t);
      |                         ^~~~~
bitaro.cpp:111:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
  111 |   cout << ans << endl;
      |           ^~~
      |           abs