Submission #4659466
Source Code Expand
#include <vector> #include <iostream> #include <cmath> #include <map> #include <unordered_map> #include <algorithm> #include <fstream> #include <unistd.h> #include <string> #include <numeric> #include <queue> #include <deque> #include <sstream> #include <iomanip> #include <set> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<vi> vvi; typedef vector<vvi> vvvi; typedef vector<bool> vb; typedef vector<vector<bool>> vvb; typedef vector<string> vs; typedef vector<vector<string>> vvs; typedef vector<char> vc; typedef vector<vector<char>> vvc; typedef pair<int, int> P; typedef pair<ll, ll> PL; typedef vector<P> vp; typedef vector<PL> vpl; typedef vector<vector<P>> vvp; typedef vector<vector<PL>> vvpl; const int INF = 1001001001; const ll LINF = 1e18; const double pi = 3.1415926535897932; const string endstr = "\n"; #define FOR(i, a, b) for(ll i = (a); i < b; i++) #define REP(i, n) for(ll i = 0; i < n; i++) #define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++) #define ff first #define ss second #define pb push_back template <typename T> T gcd(T a, T b) { return (a == 0) ? b : gcd(b%a, a); } template <typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; } bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;}; bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;}; bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;}; bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;}; template <typename T> vector<T> uniquen(vector<T> vec){ vec.erase(unique(vec.begin(), vec.end()), vec.end()); return vec; } ll n1, n2, n3; bool ok(ll x){ return x != n1 && x != n2 && x != n3; } int main(){ ll N; cin >> N; cin >> n1 >> n2 >> n3; vl dp(1000, LINF); dp[0] = 0; REP(i, 310){ if(dp[i] != LINF){ dp[i+1] = ok(i+1) ? min(dp[i+1], dp[i]+1) : LINF; dp[i+2] = ok(i+2) ? min(dp[i+2], dp[i]+1) : LINF; dp[i+3] = ok(i+3) ? min(dp[i+3], dp[i]+1) : LINF; } } cout << (dp[N] <= 100 ? "YES" : "No" ) << endstr; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - 123引き算 |
User | k_k_hiroki |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 2269 Byte |
Status | WA |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | All | ||||
---|---|---|---|---|---|
Score / Max Score | 0 / 100 | ||||
Status |
|
Set Name | Test Cases |
---|---|
All | 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 | AC | 1 ms | 256 KB |
sample_02.txt | AC | 1 ms | 256 KB |
sample_03.txt | WA | 1 ms | 256 KB |
test_143_142_141_140.txt | WA | 1 ms | 256 KB |
test_1_1_2_3.txt | WA | 1 ms | 256 KB |
test_1_2_3_4.txt | AC | 1 ms | 256 KB |
test_200_200_2_3.txt | WA | 1 ms | 256 KB |
test_231_77_78_80.txt | AC | 1 ms | 256 KB |
test_235_124_126_125.txt | WA | 1 ms | 256 KB |
test_253_45_47_48.txt | AC | 1 ms | 256 KB |
test_297_223_224_225.txt | WA | 1 ms | 256 KB |
test_297_294_292_290.txt | AC | 1 ms | 256 KB |
test_297_297_30_83.txt | WA | 1 ms | 256 KB |
test_297_3_43_72.txt | AC | 1 ms | 256 KB |
test_298_125_123_124.txt | WA | 1 ms | 256 KB |
test_298_293_295_291.txt | WA | 1 ms | 256 KB |
test_298_298_4_8.txt | WA | 1 ms | 256 KB |
test_298_36_72_98.txt | AC | 1 ms | 256 KB |
test_298_55_3_43.txt | AC | 1 ms | 256 KB |
test_298_92_91_295.txt | AC | 1 ms | 256 KB |
test_299_200_151_65.txt | AC | 1 ms | 256 KB |
test_299_240_35_154.txt | AC | 1 ms | 256 KB |
test_299_300_299_298.txt | WA | 1 ms | 256 KB |
test_299_33_242_151.txt | WA | 1 ms | 256 KB |
test_299_56_57_58.txt | WA | 1 ms | 256 KB |
test_299_66_132_198.txt | AC | 1 ms | 256 KB |
test_300_271_44_68.txt | AC | 1 ms | 256 KB |
test_300_299_298_296.txt | AC | 1 ms | 256 KB |
test_300_30_99_183.txt | WA | 1 ms | 256 KB |
test_300_4_5_6.txt | WA | 1 ms | 256 KB |
test_84_34_64_36.txt | AC | 1 ms | 256 KB |