Submission #3263545
Source Code Expand
#include<bits/stdc++.h> #include<iostream> #include<vector> #include<utility> #include<functional> #include<algorithm> #include<queue> #include<map> #include<string> #include<numeric> #define FOR(i, a, b) for(int i=a; i<b; i++) #define COUT(a) cout << a << endl; using namespace std; using Int = long long; using P = pair<Int, Int>; int main(){ Int N, K; cin >> N >> K; vector<Int> A(N); Int ind_i = 0; FOR(i, 0, N) { cin >> A[i]; if (A[i] == 1){ ind_i = i + 1; } } if (N == K){ COUT(1); }else{ Int add = 0; if((ind_i % K) > 0) add++; if((N - ind_i + 1) % (K-1) > 0) add++; if(N/2 +1 < ind_i ) add--; COUT((ind_i/K) + ((N-ind_i + 1) / (K-1) ) + add); } }
Submission Info
Submission Time | |
---|---|
Task | C - Minimization |
User | poifull10 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 838 Byte |
Status | WA |
Exec Time | 28 ms |
Memory | 1024 KB |
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 | 12 ms | 512 KB |
10.txt | WA | 22 ms | 896 KB |
2.txt | WA | 28 ms | 1024 KB |
3.txt | WA | 16 ms | 640 KB |
4.txt | WA | 28 ms | 1024 KB |
5.txt | AC | 28 ms | 1024 KB |
6.txt | AC | 28 ms | 1024 KB |
7.txt | WA | 3 ms | 256 KB |
8.txt | AC | 25 ms | 896 KB |
9.txt | WA | 1 ms | 256 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |
sample3.txt | AC | 1 ms | 256 KB |