Submission #1042613

#TimeUsernameProblemLanguageResultExecution timeMemory
1042613jmuzhenPinball (JOI14_pinball)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; struct Device { int l, r; int tp; // square that ball is tp'd to int c; // cost to put device }; struct Len { int l, r; int sz() const { return r - l + 1; } }; Len union(Len a, Len b) { Len x, y; if (a.l < b.l) { x = a; y = b; } else { x = b; y = a; } // x.l <= y.l return {y.l, x.r}; // note how if y.l > x.r then the Len is not valid } bool is_valid(Len x) { return x.l <= x.r; } int main() { int m, rows, cols; // m+2 rows, n columns, m devices, 1-indexed cin >> m >> cols; rows = m + 2; // vector<int> g(m+2+1, vector<int>(n+1)); // for demo for (int i = 0; i < m; i++) { int l, r, tp, c; cin >> l >> r >> tp >> c; Device d = {l, r, tp, c}; } int l = 1, r = cols; }

Compilation message (stderr)

pinball.cpp:17:10: error: expected identifier before '(' token
   17 | Len union(Len a, Len b) {
      |          ^
pinball.cpp:17:14: error: expected ')' before 'a'
   17 | Len union(Len a, Len b) {
      |          ~   ^~
      |              )
pinball.cpp: In function 'int main()':
pinball.cpp:39:10: warning: unused variable 'd' [-Wunused-variable]
   39 |   Device d = {l, r, tp, c};
      |          ^
pinball.cpp:42:6: warning: unused variable 'l' [-Wunused-variable]
   42 |  int l = 1, r = cols;
      |      ^
pinball.cpp:42:13: warning: unused variable 'r' [-Wunused-variable]
   42 |  int l = 1, r = cols;
      |             ^