第3回 ドワンゴからの挑戦状 予選

Submission #1030720

Source codeソースコード

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
template<class T> using vv=vector<vector< T > >;

int main() {
  int n;
  scanf("%d", &n);
  vi a;
  a.reserve(n);
  vi g(5, 0);
  rep (i, n) {
    int tmp;
    scanf("%d", &tmp);
    g[tmp] += 1;
  }
  int ans = 0;
  ans += g[4];
  ans += g[3];
  int g1 = max(0, g[1] - g[3]);
  ans += (g[2] / 2);
  int g2 = g[2] % 2;
  ans += (2 * g2 + g1 + 3) / 4;
  printf("%d\n", ans);
  return 0;
}

Submission

Task問題 C - スキーリフトの相乗り
User nameユーザ名 gosenoku
Created time投稿日時
Language言語 C++14 (Clang 3.8.0)
Status状態 AC
Score得点 400
Source lengthソースコード長 1325 Byte
File nameファイル名
Exec time実行時間 11 ms
Memory usageメモリ使用量 256 KB

Test case

Set

Set name Score得点 / Max score Cases
All 400 / 400 00_sample00,00_sample01,100_corner0000,100_corner0001,100_corner0002,100_corner0003,10_small-0000,10_small-0001,10_small-0002,10_small-0003,10_small-0004,10_small-0005,10_small-0006,10_small-0007,10_small-0008,10_small-0009,20_special-0000,20_special-0001,20_special-0002,20_special-0003,20_special-0004,20_special-0005,20_special-0006,20_special-0007,20_special-0008,20_special-0009,20_special-0010,20_special-0011,20_special-0012,20_special-0013,20_special-0014,30_large-0000,30_large-0001,30_large-0002,30_large-0003,30_large-0004,30_large-0005,30_large-0006,30_large-0007,30_large-0008,30_large-0009,80_combination-type00,80_combination-type01,80_combination-type02,80_combination-type03,80_combination-type04,80_combination-type05,80_combination-type06,90_tayama-killer00

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00_sample00 AC 3 ms 256 KB
00_sample01 AC 3 ms 256 KB
100_corner0000 AC 3 ms 256 KB
100_corner0001 AC 3 ms 256 KB
100_corner0002 AC 3 ms 256 KB
100_corner0003 AC 3 ms 256 KB
10_small-0000 AC 3 ms 256 KB
10_small-0001 AC 3 ms 256 KB
10_small-0002 AC 3 ms 256 KB
10_small-0003 AC 3 ms 256 KB
10_small-0004 AC 3 ms 256 KB
10_small-0005 AC 3 ms 256 KB
10_small-0006 AC 2 ms 256 KB
10_small-0007 AC 2 ms 256 KB
10_small-0008 AC 3 ms 256 KB
10_small-0009 AC 3 ms 256 KB
20_special-0000 AC 3 ms 256 KB
20_special-0001 AC 3 ms 256 KB
20_special-0002 AC 3 ms 256 KB
20_special-0003 AC 3 ms 256 KB
20_special-0004 AC 3 ms 256 KB
20_special-0005 AC 3 ms 256 KB
20_special-0006 AC 3 ms 256 KB
20_special-0007 AC 2 ms 256 KB
20_special-0008 AC 3 ms 256 KB
20_special-0009 AC 3 ms 256 KB
20_special-0010 AC 3 ms 256 KB
20_special-0011 AC 3 ms 256 KB
20_special-0012 AC 3 ms 256 KB
20_special-0013 AC 3 ms 256 KB
20_special-0014 AC 3 ms 256 KB
30_large-0000 AC 11 ms 256 KB
30_large-0001 AC 11 ms 256 KB
30_large-0002 AC 11 ms 256 KB
30_large-0003 AC 11 ms 256 KB
30_large-0004 AC 10 ms 256 KB
30_large-0005 AC 11 ms 256 KB
30_large-0006 AC 11 ms 256 KB
30_large-0007 AC 11 ms 256 KB
30_large-0008 AC 11 ms 256 KB
30_large-0009 AC 11 ms 256 KB
80_combination-type00 AC 3 ms 256 KB
80_combination-type01 AC 3 ms 256 KB
80_combination-type02 AC 3 ms 256 KB
80_combination-type03 AC 3 ms 256 KB
80_combination-type04 AC 3 ms 256 KB
80_combination-type05 AC 3 ms 256 KB
80_combination-type06 AC 3 ms 256 KB
90_tayama-killer00 AC 3 ms 256 KB