Submission #1070652


Source Code Expand

#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 <tuple>
#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 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);
  set<int> sn;
  rep (i, 3) {
    int tmp;
    scanf("%d", &tmp);
    if (tmp < n) {
      sn.insert(tmp);
    } else if (tmp == n) {
      printf("NO\n");
      return 0;
    }
  }

  int ngs = (int)sn.size();
  vi vn(ngs);
  auto itr = begin(sn);
  rep (i, ngs) {
    vn[i] = *(itr);
    itr++;
  }
  if (ngs == 3) {
    if (vn[0] + 1 == vn[1] + 0 && vn[1] + 1 == vn[2]) {
      printf("NO\n");
      return 0;
    }
  }

  int cnt = 0;
  int current_pos = 0;
  rep (i, ngs) {
    int next_pos;
    if ((vn[i] - current_pos) % 3 == 0) {
      next_pos = vn[i] - 1;
      cnt += (vn[i] - current_pos) / 3;
      current_pos = next_pos;
    }
  }
  cnt += (n + 2 - current_pos) / 3;
  if (cnt <= 100) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }
  return 0;
}

Submission Info

Submission Time
Task C - 123引き算
User tspcx
Language C++11 (GCC 4.8.1)
Score 100
Code Size 1758 Byte
Status AC
Exec Time 21 ms
Memory 920 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:40:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &n);
                  ^
./Main.cpp:44:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &tmp);
                      ^

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 28
Set Name Test Cases
All test_143_142_141_140.txt, test_1_1_2_3.txt, test_1_2_3_4.txt, test_200_200_2_3.txt, test_231_77_78_80.txt, test_235_124_126_125.txt, test_253_45_47_48.txt, test_297_223_224_225.txt, test_297_294_292_290.txt, test_297_297_30_83.txt, test_297_3_43_72.txt, test_298_125_123_124.txt, test_298_293_295_291.txt, test_298_298_4_8.txt, test_298_36_72_98.txt, test_298_55_3_43.txt, test_298_92_91_295.txt, test_299_200_151_65.txt, test_299_240_35_154.txt, test_299_300_299_298.txt, test_299_33_242_151.txt, test_299_56_57_58.txt, test_299_66_132_198.txt, test_300_271_44_68.txt, test_300_299_298_296.txt, test_300_30_99_183.txt, test_300_4_5_6.txt, test_84_34_64_36.txt
Case Name Status Exec Time Memory
sample_01.txt AC 21 ms 920 KB
sample_02.txt AC 19 ms 920 KB
sample_03.txt AC 20 ms 912 KB
test_143_142_141_140.txt AC 20 ms 916 KB
test_1_1_2_3.txt AC 20 ms 912 KB
test_1_2_3_4.txt AC 19 ms 920 KB
test_200_200_2_3.txt AC 20 ms 916 KB
test_231_77_78_80.txt AC 18 ms 920 KB
test_235_124_126_125.txt AC 19 ms 856 KB
test_253_45_47_48.txt AC 19 ms 916 KB
test_297_223_224_225.txt AC 20 ms 920 KB
test_297_294_292_290.txt AC 20 ms 912 KB
test_297_297_30_83.txt AC 21 ms 916 KB
test_297_3_43_72.txt AC 20 ms 920 KB
test_298_125_123_124.txt AC 20 ms 920 KB
test_298_293_295_291.txt AC 18 ms 912 KB
test_298_298_4_8.txt AC 18 ms 920 KB
test_298_36_72_98.txt AC 19 ms 916 KB
test_298_55_3_43.txt AC 20 ms 920 KB
test_298_92_91_295.txt AC 20 ms 920 KB
test_299_200_151_65.txt AC 17 ms 916 KB
test_299_240_35_154.txt AC 19 ms 916 KB
test_299_300_299_298.txt AC 18 ms 912 KB
test_299_33_242_151.txt AC 19 ms 916 KB
test_299_56_57_58.txt AC 17 ms 916 KB
test_299_66_132_198.txt AC 19 ms 916 KB
test_300_271_44_68.txt AC 19 ms 920 KB
test_300_299_298_296.txt AC 20 ms 916 KB
test_300_30_99_183.txt AC 19 ms 916 KB
test_300_4_5_6.txt AC 20 ms 916 KB
test_84_34_64_36.txt AC 20 ms 832 KB