Submission #728935

#TimeUsernameProblemLanguageResultExecution timeMemory
728935stevancvSwapping Cities (APIO20_swap)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "swap.h" #define ll long long #define ld long double #define sp ' ' #define en '\n' #define smin(a, b) a = min(a, b) #define smax(a, b) a = max(a, b) using namespace std; const int N = 1e5 + 2; const int inf = 1e9; int N, M, MX; void init(int n, int m, vector<int> u, vector<int> v, vector<int> w) { N = n; M = m; for (int i = 0; i < m; i++) smax(MX, w[i]); } int getMinimumFuelCapacity(int x, int y) { if (n == m) return MX; return -1; }

Compilation message (stderr)

swap.cpp:12:5: error: conflicting declaration 'int N'
   12 | int N, M, MX;
      |     ^
swap.cpp:10:11: note: previous declaration as 'const int N'
   10 | const int N = 1e5 + 2;
      |           ^
swap.cpp: In function 'void init(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
swap.cpp:14:7: error: assignment of read-only variable 'N'
   14 |     N = n; M = m;
      |     ~~^~~
swap.cpp: In function 'int getMinimumFuelCapacity(int, int)':
swap.cpp:18:9: error: 'n' was not declared in this scope
   18 |     if (n == m) return MX;
      |         ^
swap.cpp:18:14: error: 'm' was not declared in this scope
   18 |     if (n == m) return MX;
      |              ^