結果
| 問題 |
No.2035 Tunnel
|
| コンテスト | |
| ユーザー |
SSRS
|
| 提出日時 | 2022-08-12 21:24:36 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 331 bytes |
| コンパイル時間 | 1,618 ms |
| コンパイル使用メモリ | 167,552 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-23 00:45:15 |
| 合計ジャッジ時間 | 2,709 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 WA * 11 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:20:43: warning: 'r' may be used uninitialized [-Wmaybe-uninitialized]
20 | cout << max(N - l, cnt * 2 - 1 + (N - 1 - r)) << endl;
| ~~~~~~~^~~~
main.cpp:9:7: note: 'r' was declared here
9 | int r;
| ^
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> N;
string S;
cin >> S;
int l = -1;
int r;
int cnt = 0;
for (int i = 0; i < N; i++){
if (S[i] == '#'){
if (l == -1){
l = i;
}
r = i;
cnt++;
}
}
cout << max(N - l, cnt * 2 - 1 + (N - 1 - r)) << endl;
}
SSRS