Submission #1225991

#TimeUsernameProblemLanguageResultExecution timeMemory
1225991paskalisapo자매 도시 (APIO20_swap)C++20
Compilation error
0 ms0 KiB
#include "swap.h" #include<bits/stdc++.h> #include <vector> using namespace std; int ind1, ind2, ind3; int w1, w2, w3; vector<int> wtonode; bool skip = false; void init(int N, int M, std::vector<int> U, std::vector<int> V, std::vector<int> W) { if(N <= 3) { skip = true; return; } priority_queue<pair<int,int>> q; wtonode.resize(N , -1); for(int i = 0 ;i < M ;i++) { if(q.size() < 3) { q.push({W[i], V[i]}); } else if(q.top().first > W[i]) { q.pop(); q.push({W[i], V[i]}); } wtonode[V[i]] = W[i]; } ind1 = q.top().second; w1 = q.top().first; q.pop(); ind2 = q.top().second; w2 = q.top().first; q.pop(); ind3= q.top().second; w3 = q.top().first; q.pop(); } int getMinimumFuelCapacity(int X, int Y) { if(skip) { return -1; } int answer; if(Y == 0) { swap(X , Y); } if(X == 0) { int answer; if(Y == ind2 || Y == ind3) { answer = w1; } else { answer = wtonode[Y]; } } if(Y == ind2 || Y == ind3) { if(X == ind2 || X == ind3) { answer = w1; } answer = wtonode[X]; } else { answer = max(wtonode[X], wtonode[Y]); } return answer; } int answer = max(value1, max(value2, other)); return answer; }

Compilation message (stderr)

swap.cpp:68:22: error: 'value1' was not declared in this scope
   68 |     int answer = max(value1, max(value2, other));
      |                      ^~~~~~
swap.cpp:68:34: error: 'value2' was not declared in this scope
   68 |     int answer = max(value1, max(value2, other));
      |                                  ^~~~~~
swap.cpp:68:42: error: 'other' was not declared in this scope
   68 |     int answer = max(value1, max(value2, other));
      |                                          ^~~~~
swap.cpp:69:5: error: expected unqualified-id before 'return'
   69 |     return answer;
      |     ^~~~~~
swap.cpp:70:1: error: expected declaration before '}' token
   70 | }
      | ^