Submission #994084
Source Code Expand
#include <cstdio> #include <climits> #include <iostream> #include <string> #include <algorithm> #include <numeric> #include <functional> #include <tuple> #include <list> #include <map> #include <queue> #include <stack> #include <set> #include <vector> #define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++) using namespace std; typedef long long ll; typedef pair<int,int> PI; typedef pair<ll,ll> PL; typedef vector<int> VI; typedef vector<ll> VL; int main() { int N, A; cin >> N >> A; if(N > 1e6) return 0; VL dp(N,0); // dp[t] cookies at t ll ans = 0; REP(i,0,N) { dp[i] = i; for(ll j=0; i-j-A >= 0; j++) { if(dp[i] < dp[i-j-A] * j) { // cout << i << ", " << j << endl; } dp[i] = max(dp[i], dp[i-j-A] * j); } // cout << i+1 << ", " << dp[i] << endl; if(dp[i] >= N) { ans = i; break; } } cout << ans << endl;; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Pair Cards |
User | minus3theta |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 969 Byte |
Status | WA |
Exec Time | 4 ms |
Memory | 1024 KB |
Judge Result
Set Name | sample | all | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 700 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
sample | sample-01.txt, sample-02.txt |
all | sample-01.txt, sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt, 01-24.txt, 01-25.txt, 01-26.txt, 01-27.txt, 01-28.txt, 01-29.txt, 01-30.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | WA | 3 ms | 256 KB |
01-02.txt | WA | 3 ms | 1024 KB |
01-03.txt | WA | 3 ms | 1024 KB |
01-04.txt | WA | 3 ms | 1024 KB |
01-05.txt | WA | 3 ms | 1024 KB |
01-06.txt | WA | 3 ms | 1024 KB |
01-07.txt | WA | 3 ms | 1024 KB |
01-08.txt | WA | 4 ms | 1024 KB |
01-09.txt | WA | 4 ms | 1024 KB |
01-10.txt | WA | 4 ms | 1024 KB |
01-11.txt | WA | 4 ms | 1024 KB |
01-12.txt | WA | 3 ms | 1024 KB |
01-13.txt | WA | 4 ms | 1024 KB |
01-14.txt | WA | 3 ms | 1024 KB |
01-15.txt | WA | 3 ms | 1024 KB |
01-16.txt | WA | 3 ms | 1024 KB |
01-17.txt | WA | 4 ms | 1024 KB |
01-18.txt | WA | 4 ms | 1024 KB |
01-19.txt | WA | 4 ms | 1024 KB |
01-20.txt | WA | 4 ms | 1024 KB |
01-21.txt | WA | 3 ms | 1024 KB |
01-22.txt | WA | 3 ms | 1024 KB |
01-23.txt | WA | 3 ms | 1024 KB |
01-24.txt | WA | 4 ms | 1024 KB |
01-25.txt | WA | 4 ms | 1024 KB |
01-26.txt | WA | 4 ms | 1024 KB |
01-27.txt | AC | 3 ms | 640 KB |
01-28.txt | WA | 3 ms | 256 KB |
01-29.txt | WA | 3 ms | 256 KB |
01-30.txt | AC | 2 ms | 256 KB |
sample-01.txt | WA | 3 ms | 256 KB |
sample-02.txt | WA | 3 ms | 256 KB |