제출 #1219696

#제출 시각아이디문제언어결과실행 시간메모리
1219696DeathIsAwePark (BOI16_park)C++20
컴파일 에러
0 ms0 KiB
=#include <bits/stdc++.h> using namespace std; #define mp make_pair #define ff first #define ss second #define ll long long #define float double #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") float adjmatrix[2010][2010]; const float maxn = 10000000000000; float connection(int a, int b) { vector<float> dist(2010, maxn); priority_queue<pair<float, int>, vector<pair<float, int>>, greater<pair<float, int>>> pq; pq.push(mp((float)0, a)); pair<float, int> node; while (pq.size() > 0) { node = pq.top(); pq.pop(); if (dist[node.ss] != maxn) continue; dist[node.ss] = node.ff; for (int i=0;i<2010;i++) { if (dist[i] != maxn || adjmatrix[node.ss][i] == -1) continue; pq.push(mp(max(adjmatrix[node.ss][i], dist[node.ss]), i)); } } return dist[b]; } bool check(int a, int b, vector<float> wall, int r) { if (a == b) return true; if (wall[a] >= 2*r && wall[b] >= 2*r) { if (abs(a - b) == 2) { if (wall[5] >= 2*r && wall[6] >= 2*r) return true; } else { if (a/3 == b/3) { if (wall[5] >= 2*r) return true; } else { if (wall[6] >= 2*r) return true; } } } return false; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); for (int i=0;i<2010;i++) { for (int j=0;j<2010;j++) { adjmatrix[i][j] = -1; } } int n, m, w, h; cin >> n >> m >> w >> h; vector<vector<int>> trees(n, vector<int>(3)); vector<pair<int,int>> visitors(m); for (int i=0;i<n;i++) { cin >> trees[i][0] >> trees[i][1] >> trees[i][2]; } for (int i=0;i<m;i++) { cin >> visitors[i].ff >> visitors[i].ss; } for (int i=0;i<n;i++) { for (int j=0;j<n;j++) { if (i == j) continue; adjmatrix[i][j] = sqrt(pow(trees[i][0] - trees[j][0], 2) + pow(trees[i][1] - trees[j][1], 2)) - trees[i][2] - trees[j][2]; } } for (int i=0;i<n;i++) { adjmatrix[i][n] = h - trees[i][1] - trees[i][2]; adjmatrix[i][n + 1] = w - trees[i][0] - trees[i][2]; adjmatrix[i][n + 2] = trees[i][1] - trees[i][2]; adjmatrix[i][n + 3] = trees[i][0] - trees[i][2]; adjmatrix[n][i] = adjmatrix[i][n]; adjmatrix[n + 1][i] = adjmatrix[i][n + 1]; adjmatrix[n + 2][i] = adjmatrix[i][n + 2]; adjmatrix[n + 3][i] = adjmatrix[i][n + 3]; } //for (int i=0;i<5;i++) { // for (int j=0;j<5;j++) { // cout << adjmatrix[i][j] << ' '; // } // cout << '\n'; //} vector<float> wall(7); float ne, es, sw, wn, ns, we; ne = connection(n, n + 1); es = connection(n + 1, n + 2); sw = connection(n + 2, n + 3); wn = connection(n + 3, n); ns = connection(n, n + 2); we = connection(n + 1, n + 3); wall[1] = sw; wall[2] = es; wall[3] = ne; wall[4] = wn; wall[5] = ns; wall[6] = we; //for (int i=1;i<7;i++) { // cout << wall[i] << ' '; //} cout << '\n'; for (int i=0;i<m;i++) { for (int j=1;j<5;j++) { if (check(visitors[i].ss, j, wall, visitors[i].ff)) cout << j; } cout << '\n'; } }

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

park.cpp:1:2: error: stray '#' in program
    1 | =#include <bits/stdc++.h>
      |  ^
park.cpp:1:1: error: expected unqualified-id before '=' token
    1 | =#include <bits/stdc++.h>
      | ^
park.cpp: In function 'double connection(int, int)':
park.cpp:15:5: error: 'vector' was not declared in this scope
   15 |     vector<float> dist(2010, maxn);
      |     ^~~~~~
park.cpp:7:15: error: expected primary-expression before 'double'
    7 | #define float double
      |               ^~~~~~
park.cpp:15:12: note: in expansion of macro 'float'
   15 |     vector<float> dist(2010, maxn);
      |            ^~~~~
park.cpp:16:20: error: 'pair' was not declared in this scope
   16 |     priority_queue<pair<float, int>, vector<pair<float, int>>, greater<pair<float, int>>> pq;
      |                    ^~~~
park.cpp:16:5: error: 'priority_queue' was not declared in this scope
   16 |     priority_queue<pair<float, int>, vector<pair<float, int>>, greater<pair<float, int>>> pq;
      |     ^~~~~~~~~~~~~~
park.cpp:7:15: error: expected primary-expression before 'double'
    7 | #define float double
      |               ^~~~~~
park.cpp:16:25: note: in expansion of macro 'float'
   16 |     priority_queue<pair<float, int>, vector<pair<float, int>>, greater<pair<float, int>>> pq;
      |                         ^~~~~
park.cpp:17:5: error: 'pq' was not declared in this scope
   17 |     pq.push(mp((float)0, a));
      |     ^~
park.cpp:3:12: error: 'make_pair' was not declared in this scope
    3 | #define mp make_pair
      |            ^~~~~~~~~
park.cpp:17:13: note: in expansion of macro 'mp'
   17 |     pq.push(mp((float)0, a));
      |             ^~
park.cpp:7:15: error: expected primary-expression before 'double'
    7 | #define float double
      |               ^~~~~~
park.cpp:18:10: note: in expansion of macro 'float'
   18 |     pair<float, int> node;
      |          ^~~~~
park.cpp:20:9: error: 'node' was not declared in this scope
   20 |         node = pq.top(); pq.pop();
      |         ^~~~
park.cpp:21:13: error: 'dist' was not declared in this scope
   21 |         if (dist[node.ss] != maxn) continue;
      |             ^~~~
park.cpp:22:9: error: 'dist' was not declared in this scope
   22 |         dist[node.ss] = node.ff;
      |         ^~~~
park.cpp:25:24: error: 'max' was not declared in this scope; did you mean 'maxn'?
   25 |             pq.push(mp(max(adjmatrix[node.ss][i], dist[node.ss]), i));
      |                        ^~~
      |                        maxn
park.cpp:29:12: error: 'dist' was not declared in this scope
   29 |     return dist[b];
      |            ^~~~
park.cpp: At global scope:
park.cpp:33:26: error: 'vector' has not been declared
   33 | bool check(int a, int b, vector<float> wall, int r) {
      |                          ^~~~~~
park.cpp:33:32: error: expected ',' or '...' before '<' token
   33 | bool check(int a, int b, vector<float> wall, int r) {
      |                                ^
park.cpp: In function 'bool check(int, int, int)':
park.cpp:35:9: error: 'wall' was not declared in this scope; did you mean 'll'?
   35 |     if (wall[a] >= 2*r && wall[b] >= 2*r) {
      |         ^~~~
      |         ll
park.cpp:35:22: error: 'r' was not declared in this scope
   35 |     if (wall[a] >= 2*r && wall[b] >= 2*r) {
      |                      ^
park.cpp:36:13: error: 'abs' was not declared in this scope
   36 |         if (abs(a - b) == 2) {
      |             ^~~
park.cpp: In function 'int main()':
park.cpp:51:5: error: 'ios_base' has not been declared
   51 |     ios_base::sync_with_stdio(false);
      |     ^~~~~~~~
park.cpp:52:5: error: 'cin' was not declared in this scope
   52 |     cin.tie(NULL);
      |     ^~~
park.cpp:52:13: error: 'NULL' was not declared in this scope
   52 |     cin.tie(NULL);
      |             ^~~~
park.cpp:1:1: note: 'NULL' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
  +++ |+#include <cstddef>
    1 | =#include <bits/stdc++.h>
park.cpp:61:12: error: 'vector' was not declared in this scope
   61 |     vector<vector<int>> trees(n, vector<int>(3));
      |            ^~~~~~
park.cpp:61:19: error: expected primary-expression before 'int'
   61 |     vector<vector<int>> trees(n, vector<int>(3));
      |                   ^~~
park.cpp:62:12: error: 'pair' was not declared in this scope
   62 |     vector<pair<int,int>> visitors(m);
      |            ^~~~
park.cpp:62:17: error: expected primary-expression before 'int'
   62 |     vector<pair<int,int>> visitors(m);
      |                 ^~~
park.cpp:64:16: error: 'trees' was not declared in this scope
   64 |         cin >> trees[i][0] >> trees[i][1] >> trees[i][2];
      |                ^~~~~
park.cpp:67:16: error: 'visitors' was not declared in this scope
   67 |         cin >> visitors[i].ff >> visitors[i].ss;
      |                ^~~~~~~~
park.cpp:74:40: error: 'trees' was not declared in this scope
   74 |             adjmatrix[i][j] = sqrt(pow(trees[i][0] - trees[j][0], 2) + pow(trees[i][1] - trees[j][1], 2)) - trees[i][2] - trees[j][2];
      |                                        ^~~~~
park.cpp:74:36: error: 'pow' was not declared in this scope
   74 |             adjmatrix[i][j] = sqrt(pow(trees[i][0] - trees[j][0], 2) + pow(trees[i][1] - trees[j][1], 2)) - trees[i][2] - trees[j][2];
      |                                    ^~~
park.cpp:74:31: error: 'sqrt' was not declared in this scope
   74 |             adjmatrix[i][j] = sqrt(pow(trees[i][0] - trees[j][0], 2) + pow(trees[i][1] - trees[j][1], 2)) - trees[i][2] - trees[j][2];
      |                               ^~~~
park.cpp:78:31: error: 'trees' was not declared in this scope
   78 |         adjmatrix[i][n] = h - trees[i][1] - trees[i][2];
      |                               ^~~~~
park.cpp:7:15: error: expected primary-expression before 'double'
    7 | #define float double
      |               ^~~~~~
park.cpp:96:12: note: in expansion of macro 'float'
   96 |     vector<float> wall(7);
      |            ^~~~~
park.cpp:100:5: error: 'wall' was not declared in this scope; did you mean 'll'?
  100 |     wall[1] = sw; wall[2] = es; wall[3] = ne; wall[4] = wn; wall[5] = ns; wall[6] = we;
      |     ^~~~
      |     ll
park.cpp:110:23: error: 'visitors' was not declared in this scope
  110 |             if (check(visitors[i].ss, j, wall, visitors[i].ff)) cout << j;
      |                       ^~~~~~~~
park.cpp:110:65: error: 'cout' was not declared in this scope
  110 |             if (check(visitors[i].ss, j, wall, visitors[i].ff)) cout << j;
      |                                                                 ^~~~
park.cpp:112:9: error: 'cout' was not declared in this scope
  112 |         cout << '\n';
      |         ^~~~