Submission #2894415
Source Code Expand
#include <stdio.h> #include <stdlib.h> int main(void){ int N; int K; int i; int j; int min; scanf("%d",&N); scanf("%d",&K); int A[N]; for(i = 0;i<N;i++){ scanf("%d",&A[i]); } for(i = 0;i<N;i++){ if(A[i] == 1){ min = i; } } i = min/(K-1); if(min-(K-1)*i > 0){ i = i + 1; } j = (N-min-1)/(K-1); if((N-min-1)-(K-1)*j > 0){ j = j + 1; } printf("%d",i+j); return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Minimization |
User | maron16 |
Language | C (GCC 5.4.1) |
Score | 0 |
Code Size | 415 Byte |
Status | WA |
Exec Time | 11 ms |
Memory | 512 KB |
Compile Error
./Main.c: In function ‘main’: ./Main.c:10:1: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&N); ^ ./Main.c:11:1: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&K); ^ ./Main.c:14:1: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&A[i]); ^
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample1.txt, sample2.txt, sample3.txt |
All | sample1.txt, sample2.txt, sample3.txt, 1.txt, 10.txt, 2.txt, 3.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, sample1.txt, sample2.txt, sample3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
1.txt | AC | 5 ms | 384 KB |
10.txt | AC | 8 ms | 512 KB |
2.txt | AC | 11 ms | 512 KB |
3.txt | AC | 6 ms | 384 KB |
4.txt | WA | 10 ms | 512 KB |
5.txt | WA | 11 ms | 512 KB |
6.txt | WA | 11 ms | 512 KB |
7.txt | AC | 1 ms | 128 KB |
8.txt | AC | 9 ms | 512 KB |
9.txt | WA | 1 ms | 128 KB |
sample1.txt | AC | 0 ms | 128 KB |
sample2.txt | AC | 1 ms | 128 KB |
sample3.txt | AC | 1 ms | 128 KB |