Submission #187316
Source Code Expand
#include <iostream> #include <iomanip> #include <sstream> #include <vector> #include <string> #include <set> #include <map> #include <stack> #include <queue> #include <algorithm> #include <functional> #include <iterator> #include <limits> #include <numeric> #include <utility> #include <cmath> using namespace std; using namespace placeholders; using LL = long long; using ULL = unsigned long long; using VI = vector<int>; using VVI = vector<VI>; using VS = vector<string>; using SS = stringstream; using PII = pair<int,int>; using VPII = vector< pair<int,int> >; template < typename T = int > using VT = vector<T>; template < typename T = int > using VVT = VT< VT<T> >; template < typename T = int > using LIM = numeric_limits<T>; template < typename T > inline T fromString( const string &s ){ T res; istringstream iss( s ); iss >> res; return res; }; template < typename T > inline string toString( const T &a ){ ostringstream oss; oss << a; return oss.str(); }; #define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i ) #define FOR( e, c ) for ( auto &e : c ) #define ALL( c ) (c).begin(), (c).end() #define AALL( a, t ) (t*)a, (t*)a + sizeof( a ) / sizeof( t ) #define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end() #define PB( n ) push_back( n ) #define MP( a, b ) make_pair( ( a ), ( b ) ) #define EXIST( c, e ) ( (c).find( e ) != (c).end() ) #define fst first #define snd second #define DUMP( x ) cerr << #x << " = " << ( x ) << endl constexpr int INF = LIM<>::max() / 4; int main() { cin.tie( 0 ); ios::sync_with_stdio( false ); int n; cin >> n; VI ng( 512 ); REP( i, 0, 3 ) { int a; cin >> a; ng[a] = true; } VI dp( 512, INF ); dp[0] = 0; REP( i, 0, 300 ) { REP( j, 1, 4 ) { if ( !ng[ i + j ] ) { dp[ i + j ] = min( dp[ i + j ], dp[i] + 1 ); } } } cout << ( dp[n] <= 100 ? "YES" : "NO" ) << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - 123引き算 |
User | torus711 |
Language | C++11 (GCC 4.8.1) |
Score | 100 |
Code Size | 1981 Byte |
Status | AC |
Exec Time | 40 ms |
Memory | 932 KB |
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
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 | 924 KB |
sample_02.txt | AC | 31 ms | 924 KB |
sample_03.txt | AC | 28 ms | 796 KB |
test_143_142_141_140.txt | AC | 36 ms | 928 KB |
test_1_1_2_3.txt | AC | 33 ms | 920 KB |
test_1_2_3_4.txt | AC | 25 ms | 920 KB |
test_200_200_2_3.txt | AC | 20 ms | 796 KB |
test_231_77_78_80.txt | AC | 28 ms | 924 KB |
test_235_124_126_125.txt | AC | 21 ms | 796 KB |
test_253_45_47_48.txt | AC | 29 ms | 804 KB |
test_297_223_224_225.txt | AC | 21 ms | 800 KB |
test_297_294_292_290.txt | AC | 40 ms | 916 KB |
test_297_297_30_83.txt | AC | 24 ms | 924 KB |
test_297_3_43_72.txt | AC | 20 ms | 924 KB |
test_298_125_123_124.txt | AC | 23 ms | 924 KB |
test_298_293_295_291.txt | AC | 20 ms | 796 KB |
test_298_298_4_8.txt | AC | 23 ms | 772 KB |
test_298_36_72_98.txt | AC | 21 ms | 796 KB |
test_298_55_3_43.txt | AC | 22 ms | 924 KB |
test_298_92_91_295.txt | AC | 22 ms | 932 KB |
test_299_200_151_65.txt | AC | 22 ms | 800 KB |
test_299_240_35_154.txt | AC | 21 ms | 800 KB |
test_299_300_299_298.txt | AC | 20 ms | 924 KB |
test_299_33_242_151.txt | AC | 21 ms | 932 KB |
test_299_56_57_58.txt | AC | 35 ms | 796 KB |
test_299_66_132_198.txt | AC | 20 ms | 800 KB |
test_300_271_44_68.txt | AC | 22 ms | 932 KB |
test_300_299_298_296.txt | AC | 20 ms | 924 KB |
test_300_30_99_183.txt | AC | 21 ms | 800 KB |
test_300_4_5_6.txt | AC | 22 ms | 928 KB |
test_84_34_64_36.txt | AC | 32 ms | 924 KB |