Submission #1591730


Source Code Expand

g#include <bits/stdc++.h>

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define INF 2000000000

#ifdef LOCAL
  #define eprintf(...) fprintf(stdout, __VA_ARGS__)
#else
  #define eprintf(...) 0
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;

int main() {
  int n;
  cin >> n;
  vector<int> v(9, 0);
  int a;
  REP(i, n) {
    cin >> a;
    if(a <= 399) v[0]++;
    else if(a <= 799) v[1]++;
    else if(a <= 1199) v[2]++;
    else if(a <= 1599) v[3]++;
    else if(a <= 1999) v[4]++;
    else if(a <= 2399) v[5]++;
    else if(a <= 2799) v[6]++;
    else if(a <= 3199) v[7]++;
    else v[8]++;
  }

  int colors = 0;
  int zero = 0;
  REP(i, v.size()-1) {
    if(v[i] > 0) colors++;
    else zero++;
  }
  int free = v[8];
  int maxc = colors + min(zero, free);
  int minc = colors == 0 ? 1 : colors;
  eprintf("col,zero,free:%d,%d,%d\n", colors,zero,free);

  printf("%d %d\n", minc, maxc);

  return 0;
}

Submission Info

Submission Time
Task C - Colorful Leaderboard
User yoshi_k
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1123 Byte
Status CE

Compile Error

./Main.cpp:1:2: error: stray ‘#’ in program
 g#include <bits/stdc++.h>
  ^
./Main.cpp:1:1: error: ‘g’ does not name a type
 g#include <bits/stdc++.h>
 ^
./Main.cpp: In function ‘int main()’:
./Main.cpp:22:3: error: ‘cin’ was not declared in this scope
   cin >> n;
   ^
./Main.cpp:23:3: error: ‘vector’ was not declared in this scope
   vector<int> v(9, 0);
   ^
./Main.cpp:23:10: error: expected primary-expression before ‘int’
   vector<int> v(9, 0);
          ^
./Main.cpp:27:18: error: ‘v’ was not declared in this scope
     if(a <= 399) v[0]++;
                  ^
./Main.cpp:28:23: error: ‘v’ was not declared in this scope
     else if(a <= 799) v[1]++;
                       ^
./Main.cpp:29:24: error: ‘v’ was not declared in this scope
     else if(a <= 1199) v[2]++;
                        ^
./Main.cpp:30:24: error: ‘v’ was not declared in this scope
     else if(a <= 1599) v[3]++;
                        ^
./Main.cpp:31:24: error: ‘v’ was not declared in this scope
     else if(a <= 1999) v[4]++;
...