Submission #6904360


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

const int N_MAX = 310;
const int INF = 1e9;

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N;cin >> N;
  set<int> st;
  rep(i,3){
    int x;cin >> x;
    st.insert(x);
  }
  //最短何回でiにできるか
  int dp[N_MAX];
  rep(i,N_MAX) dp[i] = INF;
  dp[0] = 0;
  rep(i,100){
    rep(j,N_MAX)if(!st.count(j)) repp(k,1,min(j+1,4))dp[j] = min(dp[j],dp[j-k]+1);
  }
  YESNO(dp[N]<=100);
  return 0;
}

Submission Info

Submission Time
Task C - 123引き算
User mitsuki_AC
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1537 Byte
Status
Exec Time 1 ms
Memory 256 KB

Test Cases

Set Name Score / Max Score Test Cases
All 100 / 100 sample_01.txt, sample_02.txt, sample_03.txt, 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 1 ms 256 KB
sample_02.txt 1 ms 256 KB
sample_03.txt 1 ms 256 KB
test_143_142_141_140.txt 1 ms 256 KB
test_1_1_2_3.txt 1 ms 256 KB
test_1_2_3_4.txt 1 ms 256 KB
test_200_200_2_3.txt 1 ms 256 KB
test_231_77_78_80.txt 1 ms 256 KB
test_235_124_126_125.txt 1 ms 256 KB
test_253_45_47_48.txt 1 ms 256 KB
test_297_223_224_225.txt 1 ms 256 KB
test_297_294_292_290.txt 1 ms 256 KB
test_297_297_30_83.txt 1 ms 256 KB
test_297_3_43_72.txt 1 ms 256 KB
test_298_125_123_124.txt 1 ms 256 KB
test_298_293_295_291.txt 1 ms 256 KB
test_298_298_4_8.txt 1 ms 256 KB
test_298_36_72_98.txt 1 ms 256 KB
test_298_55_3_43.txt 1 ms 256 KB
test_298_92_91_295.txt 1 ms 256 KB
test_299_200_151_65.txt 1 ms 256 KB
test_299_240_35_154.txt 1 ms 256 KB
test_299_300_299_298.txt 1 ms 256 KB
test_299_33_242_151.txt 1 ms 256 KB
test_299_56_57_58.txt 1 ms 256 KB
test_299_66_132_198.txt 1 ms 256 KB
test_300_271_44_68.txt 1 ms 256 KB
test_300_299_298_296.txt 1 ms 256 KB
test_300_30_99_183.txt 1 ms 256 KB
test_300_4_5_6.txt 1 ms 256 KB
test_84_34_64_36.txt 1 ms 256 KB