CSES - Aalto Competitive Programming 2024 - wk2 - Wed - Results
Submission details
Task:Old legos
Sender:aalto2024b_001
Submission time:2024-09-11 17:04:06 +0300
Language:C++ (C++11)
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main(int, char**)':
input/code.cpp:28:18: error: expected ';' before '}' token
   28 |         maija_sum
      |                  ^
      |                  ;
   29 |     }
      |     ~             
input/code.cpp:28:9: warning: statement has no effect [-Wunused-value]
   28 |         maija_sum
      |         ^~~~~~~~~
input/code.cpp:24:9: warning: unused variable 'uolevi_sum' [-Wunused-variable]
   24 |     int uolevi_sum = 0;
      |         ^~~~~~~~~~

Code

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <tuple>
#include <vector>

using namespace std;

int main (int argc, char *argv[]) {
    int n;
    cin >> n;
    vector<tuple<int, int, int>> legos(n);
    for (int i = 0; i < n; i++) {
        int uolevi, maija;
        cin >> uolevi >> maija;
        legos[i] = make_tuple(uolevi - maija, uolevi, maija);
    }
    sort(legos.begin(), legos.end());
    for (int i = 0; i < n; i++) {
        cout << get<0>(legos[i]) << " ";
        cout << get<1>(legos[i]) << " ";
        cout << get<2>(legos[i]) << " \n";
    }
    int uolevi_sum = 0;
    int maija_sum = 0;
    int half_way = n % 2 == 0 ? n / 2 : n / 2 + 1;
    for (int i = 0; i < half_way; i++) {
        maija_sum
    }

    cout << "\n";

    return 0;
}