CSES - Putka Open 2015 – finaali - Results
Submission details
Task:Omenat
Sender:Henrik Lievonen
Submission time:2015-12-20 13:55:17 +0200
Language:C++
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:12:7: error: expected ';' before 'u'
   ull u = 0;
       ^
input/code.cpp:12:12: warning: statement has no effect [-Wunused-value]
   ull u = 0;
            ^
input/code.cpp:13:7: error: expected ';' before 'm'
   ull m = 0;
       ^
input/code.cpp:13:12: warning: statement has no effect [-Wunused-value]
   ull m = 0;
            ^
input/code.cpp:15:9: error: expected ';' before 'a'
     ull a;
         ^
input/code.cpp:15:10: warning: statement has no effect [-Wunused-value]
     ull a;
          ^
input/code.cpp:16:12: error: 'a' was not declared in this scope
     cin >> a
            ^
input/code.cpp:20:7: error: 'else' without a previous 'if'
     } else {
       ^
input/code.cpp:22:7: error: 'u' was not declared in this scope
       u += a;
       ^

Code

// G

#include <iostream>

using namespace std;

unsigned long long int ull;

int main() {
  int n;
  cin >> n;
  ull u = 0;
  ull m = 0;
  for (int i = 0; i < n; i++) {
    ull a;
    cin >> a
    if (u > m) {
      cout << "2\n";
      m += a;
    } else {
      cout << "1\n";
      u += a;
    }
  }   
}