Submission #425297
Source Code Expand
#include<iostream>
using namespace std;
int main(void){
int N,R;
char S[100];
cin >> N >> R >> S;
int Time=0, x=0, xMax=N-1;//かかる時間、イカの座標、x座標+R-1の最大値
while (S[xMax] == 'o')xMax--;
xMax -= R - 1;
if (xMax < 0){
cout << "0\n";
return 0;
}
bool f = false;
while (1){
if (S[x] == '.' || x==xMax){
for (int i = 0; i < R; i++){
S[x + i] = 'o';
if (x + i>xMax + R - 2){
f = true;
break;
}
}
Time++;
if (f)break;
}
else{
if (x > xMax)break;
x++;
Time++;
}
}
cout << Time << "\n";
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - 直線塗り |
| User | gotchman01 |
| Language | C++ (GCC 4.9.2) |
| Score | 0 |
| Code Size | 642 Byte |
| Status | WA |
| Exec Time | 25 ms |
| Memory | 928 KiB |
Judge Result
| Set Name | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 100 | ||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample-01.txt, sample-02.txt, sample-03.txt |
| All | sample-01.txt, sample-02.txt, sample-03.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 |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 01-01.txt | AC | 25 ms | 928 KiB |
| 01-02.txt | AC | 23 ms | 800 KiB |
| 01-03.txt | AC | 23 ms | 800 KiB |
| 01-04.txt | AC | 22 ms | 924 KiB |
| 01-05.txt | AC | 23 ms | 920 KiB |
| 01-06.txt | AC | 25 ms | 800 KiB |
| 01-07.txt | AC | 24 ms | 800 KiB |
| 01-08.txt | AC | 23 ms | 800 KiB |
| 01-09.txt | AC | 23 ms | 920 KiB |
| 01-10.txt | AC | 22 ms | 844 KiB |
| 01-11.txt | AC | 24 ms | 672 KiB |
| 01-12.txt | AC | 24 ms | 928 KiB |
| 01-13.txt | AC | 24 ms | 796 KiB |
| 01-14.txt | AC | 24 ms | 800 KiB |
| 01-15.txt | AC | 25 ms | 672 KiB |
| 01-16.txt | AC | 24 ms | 672 KiB |
| 01-17.txt | WA | 24 ms | 700 KiB |
| 01-18.txt | AC | 22 ms | 924 KiB |
| sample-01.txt | AC | 24 ms | 920 KiB |
| sample-02.txt | AC | 24 ms | 924 KiB |
| sample-03.txt | AC | 24 ms | 796 KiB |