結果

問題 No.607 開通777年記念
ユーザー yuppe19 😺yuppe19 😺
提出日時 2017-12-07 16:23:11
言語 C++11
(gcc 11.4.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 613 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 51,116 KB
最終ジャッジ日時 2024-04-27 02:30:32
合計ジャッジ時間 654 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、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);
      |             ~~~~~^~~~~~~~~~~~~~~~

ソースコード

diff #

#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;
}
0