제출 #1063409

#제출 시각아이디문제언어결과실행 시간메모리
1063409nima_aryanBitaro’s Party (JOI18_bitaro)Java
컴파일 에러
0 ms0 KiB
/** * author: NimaAryan * created: 2024-08-17 20:59:09 **/ #include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "algo/debug.h" #endif using i64 = long long; constexpr int SQ = 300; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N, M, Q; cin >> N >> M >> Q; vector<vector<int>> g(N + 1); for (int i = 0; i < M; ++i) { int s, e; cin >> s >> e; --s, --e; g[e].push_back(s); } vector<vector<pair<int, int>>> f(N); for (int x = 0; x < N; ++x) { vector<pair<int, int>> cf{{-1, x}}; for (int y : g[x]) { cf.insert(cf.end(), f[y].begin(), f[y].end()); } sort(cf.begin(), cf.end(), greater<>()); set<int> ex; for (int i = 0; i < cf.size() && f[x].size() < SQ; ++i) { auto [d, s] = cf[i]; d += 1; if (ex.count(s)) { continue; } ex.insert(s); f[x].emplace_back(d, s); } } while (Q--) { int t, y; cin >> t >> y; --t; set<int> ex; for (int i = 0; i < y; ++i) { int c; cin >> c; --c; ex.insert(c); } if (y >= SQ) { vector<int> dp(t + 1); for (int x = 0; x <= t; ++x) { dp[x] = ex.count(x) ? -N : 0; for (int y : g[x]) { dp[x] = max(dp[x], dp[y] + 1); } } cout << max(-1, dp[t]) << "\n"; continue; } int ans = -1; for (auto [d, s] : f[t]) { if (!ex.count(s)) { ans = max(ans, d); } } cout << ans << "\n"; } return 0; }

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

bitaro.java:5: error: illegal character: '#'
#include <bits/stdc++.h>
^
bitaro.java:5: error: class, interface, or enum expected
#include <bits/stdc++.h>
         ^
bitaro.java:9: error: illegal character: '#'
#ifdef LOCAL
^
bitaro.java:10: error: illegal character: '#'
#include "algo/debug.h"
^
bitaro.java:11: error: illegal character: '#'
#endif
^
bitaro.java:15: error: class, interface, or enum expected
constexpr int SQ = 300;
^
bitaro.java:17: error: class, interface, or enum expected
int main() {
^
bitaro.java:19: error: class, interface, or enum expected
  cin.tie(nullptr);
  ^
bitaro.java:21: error: class, interface, or enum expected
  int N, M, Q;
  ^
bitaro.java:22: error: class, interface, or enum expected
  cin >> N >> M >> Q;
  ^
bitaro.java:24: error: class, interface, or enum expected
  vector<vector<int>> g(N + 1);
  ^
bitaro.java:25: error: class, interface, or enum expected
  for (int i = 0; i < M; ++i) {
  ^
bitaro.java:25: error: class, interface, or enum expected
  for (int i = 0; i < M; ++i) {
                  ^
bitaro.java:25: error: class, interface, or enum expected
  for (int i = 0; i < M; ++i) {
                         ^
bitaro.java:27: error: class, interface, or enum expected
    cin >> s >> e;
    ^
bitaro.java:28: error: class, interface, or enum expected
    --s, --e;
    ^
bitaro.java:29: error: class, interface, or enum expected
    g[e].push_back(s);
    ^
bitaro.java:30: error: class, interface, or enum expected
  }
  ^
bitaro.java:33: error: class, interface, or enum expected
  for (int x = 0; x < N; ++x) {
  ^
bitaro.java:33: error: class, interface, or enum expected
  for (int x = 0; x < N; ++x) {
                  ^
bitaro.java:33: error: class, interface, or enum expected
  for (int x = 0; x < N; ++x) {
                         ^
bitaro.java:35: error: class, interface, or enum expected
    for (int y : g[x]) {
    ^
bitaro.java:37: error: class, interface, or enum expected
    }
    ^
bitaro.java:39: error: class, interface, or enum expected
    set<int> ex;
    ^
bitaro.java:40: error: class, interface, or enum expected
    for (int i = 0; i < cf.size() && f[x].size() < SQ; ++i) {
    ^
bitaro.java:40: error: class, interface, or enum expected
    for (int i = 0; i < cf.size() && f[x].size() < SQ; ++i) {
                    ^
bitaro.java:40: error: class, interface, or enum expected
    for (int i = 0; i < cf.size() && f[x].size() < SQ; ++i) {
                                                       ^
bitaro.java:42: error: class, interface, or enum expected
      d += 1;
      ^
bitaro.java:43: error: class, interface, or enum expected
      if (ex.count(s)) {
      ^
bitaro.java:45: error: class, interface, or enum expected
      }
      ^
bitaro.java:47: error: class, interface, or enum expected
      f[x].emplace_back(d, s);
      ^
bitaro.java:48: error: class, interface, or enum expected
    }
    ^
bitaro.java:53: error: class, interface, or enum expected
    cin >> t >> y;
    ^
bitaro.java:54: error: class, interface, or enum expected
    --t;
    ^
bitaro.java:55: error: class, interface, or enum expected
    set<int> ex;
    ^
bitaro.java:56: error: class, interface, or enum expected
    for (int i = 0; i < y; ++i) {
    ^
bitaro.java:56: error: class, interface, or enum expected
    for (int i = 0; i < y; ++i) {
                    ^
bitaro.java:56: error: class, interface, or enum expected
    for (int i = 0; i < y; ++i) {
                           ^
bitaro.java:58: error: class, interface, or enum expected
      cin >> c;
      ^
bitaro.java:59: error: class, interface, or enum expected
      --c;
      ^
bitaro.java:60: error: class, interface, or enum expected
      ex.insert(c);
      ^
bitaro.java:61: error: class, interface, or enum expected
    }
    ^
bitaro.java:64: error: class, interface, or enum expected
      for (int x = 0; x <= t; ++x) {
      ^
bitaro.java:64: error: class, interface, or enum expected
      for (int x = 0; x <= t; ++x) {
                      ^
bitaro.java:64: error: class, interface, or enum expected
      for (int x = 0; x <= t; ++x) {
                              ^
bitaro.java:66: error: class, interface, or enum expected
        for (int y : g[x]) {
        ^
bitaro.java:68: error: class, interface, or enum expected
        }
        ^
bitaro.java:71: error: class, interface, or enum expected
      continue;
      ^
bitaro.java:72: error: class, interface, or enum expected
    }
    ^
bitaro.java:74: error: class, interface, or enum expected
    for (auto [d, s] : f[t]) {
    ^
bitaro.java:77: error: class, interface, or enum expected
      }
      ^
bitaro.java:80: error: class, interface, or enum expected
  }
  ^
bitaro.java:83: error: class, interface, or enum expected
}
^
53 errors