CSES - Siperia opettaa 5.0 - Results
Submission details
Task:Distribution Center
Sender:JesseNiininen
Submission time:2017-03-09 13:13:46 +0200
Language:C++
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:19:5: error: expected '(' before '}' token
     }
     ^
input/code.cpp:16:9: warning: unused variable 'skipTo' [-Wunused-variable]
     int skipTo = 0;
         ^

Code

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;

    vector<int> v(n);
    for(int i = 0; i < n; i++){
        int num;
        cin >> num;
        v[i] = num;
    }

    int skipTo = 0;
    for(int i = 0; i < n; i++){
        if
    }

    for(int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        if(a > b){
            sort(v.begin() + b, v.begin() + a + 1);
            reverse(v.begin() + b, v.begin() + a + 1);
        }else{
            sort(v.begin() + a, v.begin() + b + 1);
        }
    }

    cout << v[n / 2];
}