제출 #1338799

#제출 시각아이디문제언어결과실행 시간메모리
1338799riafhasan2010Coin Collecting (JOI19_ho_t4)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int N = 3e5 + 7;
int v[N][3];
int n;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  v[n * 3][1] = v[n * 3][2] = n * 2;
  ll ans = 0;
  for (int i = 1; i <= n * 2; i++) {
    int x, y; cin >> x >> y;
    if (x >= 1 and x <= n and y >= 1 and y <= 2) {
      v[x][y]++;
    }
    else if (x >= 1 and x <= n) {
      if (y > 2) {
        ans += abs(y - 2);
        y = 2;
      }
      else {
        ans += abs(1 - y);
        y = 1;
      }
      v[x][y]++;
    }
    else if (y >= 1 and y <= 2) {
      if (x > n) {
        ans += abs(n - x);
        x = n;
      }
      else {
        ans += abs(1 - x);
        x = 1;
      }
      v[x][y]++;
    }
    else {
      if (x <= 0 and y <= 0) {
        ans += abs(x - 1);
        ans += abs(y - 1);
        v[1][1]++;
      }
      else if (x > n and y <= 0) {
        ans += abs(x - n);
        ans += abs(y - 1);
        v[n][1]++;
      }
      else if (x <= 0 and y > 2) {
        ans += abs(x - 1);
        ans += abs(y - 2);
        v[1][2]++;
      }
      else {
        ans += abs(x - n);
        ans += abs(y - 2);
        v[n][2]++;
      }
    }
  }
  vector<pair<int, int>> 
  cout << ans << '\n';
}

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

joi2019_ho_t4.cpp: In function 'int main()':
joi2019_ho_t4.cpp:66:8: error: expected initializer before '<<' token
   66 |   cout << ans << '\n';
      |        ^~