結果
| 問題 |
No.607 開通777年記念
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-12-07 16:23:11 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 613 bytes |
| コンパイル時間 | 339 ms |
| コンパイル使用メモリ | 51,532 KB |
| 最終ジャッジ日時 | 2024-11-14 20:17:43 |
| 合計ジャッジ時間 | 862 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:3: error: ‘vector’ was not declared in this scope
8 | vector<vector<int>> a(m, vector<int>(n, 0)); // a[m][n]
| ^~~~~~
main.cpp:3:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
2 | #include <algorithm>
+++ |+#include <vector>
3 | using namespace std;
main.cpp:8:17: error: expected primary-expression before ‘int’
8 | vector<vector<int>> a(m, vector<int>(n, 0)); // a[m][n]
| ^~~
main.cpp:9:10: error: expected primary-expression before ‘int’
9 | vector<int> b(n, 0); // b[i] := [0, i) の乗車人数
| ^~~
main.cpp:12:20: error: ‘a’ was not declared in this scope
12 | scanf("%d", &a[i][j]);
| ^
main.cpp:13:7: error: ‘b’ was not declared in this scope
13 | b[j] += a[i][j];
| ^
main.cpp:17:14: error: ‘b’ was not declared in this scope
17 | acc += b[r];
| ^
main.cpp:7:18: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | int n, m; scanf("%d%d", &n, &m);
| ~~~~~^~~~~~~~~~~~~~~~
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
using i64 = long long;
int main(void) {
int n, m; scanf("%d%d", &n, &m);
vector<vector<int>> a(m, vector<int>(n, 0)); // a[m][n]
vector<int> b(n, 0); // b[i] := [0, i) の乗車人数
for(int i=0; i<m; ++i) {
for(int j=0; j<n; ++j) {
scanf("%d", &a[i][j]);
b[j] += a[i][j];
}
int acc = 0;
for(int l=0, r=0; r<n; ++r) {
acc += b[r];
while(acc > 777) {
acc -= b[l];
++l;
}
if(acc == 777) {
puts("YES");
return 0;
}
}
}
puts("NO");
return 0;
}