CSES - Datatähti 2017 alku - Results
Submission details
Task:Kolikot
Sender:ollpu
Submission time:2016-10-06 21:58:17 +0300
Language:C++
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:14:14: error: 'sort' was not declared in this scope
   sort(t, t+n);
              ^

Code

#include <iostream>

using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  int t[n];
  for (int i = 0; i < n; ++i) {
    cin >> t[i];
  }
  sort(t, t+n);
  long gstart = 1;
  for (int i = 0; i < n; ++i) {
    if (gstart < t[i]) break;
    gstart += t[i];
  }
  cout << gstart;
}