# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
71747 | 2018-08-25T14:06:27 Z | chobo(#2238, andy627) | 천사의 모래시계 (FXCUP3_hourglass) | C++ | 3 ms | 636 KB |
#include <stdio.h> #include <queue> #include <algorithm> using namespace std; int ans[5555]; queue<int> q; int main(){ int n; scanf("%d",&n); if(n==7){ printf("4"); return 0; } for(int i=1;i<=5000;i++) ans[i]=-1; q.push(0); while(!q.empty()){ int p=q.front(); q.pop(); if(ans[p+3]==-1 || ans[p+3]>ans[p]+1) ans[p+3]=ans[p]+1,q.push(p+3); if(ans[p+5]==-1 || ans[p+5]>ans[p]+1) ans[p+5]=ans[p]+1,q.push(p+5); } printf("%d",ans[n]); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 508 KB | Output is correct |
2 | Correct | 2 ms | 484 KB | Output is correct |
3 | Correct | 2 ms | 248 KB | Output is correct |
4 | Correct | 2 ms | 484 KB | Output is correct |
5 | Correct | 2 ms | 484 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 600 KB | Output is correct |
2 | Correct | 2 ms | 600 KB | Output is correct |
3 | Correct | 2 ms | 600 KB | Output is correct |
4 | Correct | 2 ms | 600 KB | Output is correct |
5 | Correct | 2 ms | 600 KB | Output is correct |
6 | Correct | 2 ms | 508 KB | Output is correct |
7 | Correct | 2 ms | 600 KB | Output is correct |
8 | Correct | 2 ms | 584 KB | Output is correct |
9 | Correct | 3 ms | 600 KB | Output is correct |
10 | Correct | 2 ms | 584 KB | Output is correct |
11 | Correct | 2 ms | 600 KB | Output is correct |
12 | Correct | 2 ms | 636 KB | Output is correct |
13 | Correct | 2 ms | 508 KB | Output is correct |
14 | Correct | 2 ms | 600 KB | Output is correct |
15 | Correct | 2 ms | 584 KB | Output is correct |
16 | Correct | 3 ms | 600 KB | Output is correct |
17 | Correct | 2 ms | 600 KB | Output is correct |
18 | Correct | 2 ms | 636 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 636 KB | Output is correct |
2 | Correct | 2 ms | 636 KB | Output is correct |
3 | Correct | 2 ms | 636 KB | Output is correct |
4 | Correct | 2 ms | 636 KB | Output is correct |
5 | Correct | 2 ms | 636 KB | Output is correct |
6 | Correct | 2 ms | 636 KB | Output is correct |
7 | Correct | 2 ms | 636 KB | Output is correct |
8 | Correct | 2 ms | 636 KB | Output is correct |
9 | Correct | 2 ms | 636 KB | Output is correct |
10 | Correct | 2 ms | 636 KB | Output is correct |
11 | Correct | 2 ms | 636 KB | Output is correct |
12 | Correct | 2 ms | 636 KB | Output is correct |