結果

問題 No.1908 Assault for Keys
ユーザー kpinkcatkpinkcat
提出日時 2023-09-21 09:44:42
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 684 bytes
コンパイル時間 2,074 ms
コンパイル使用メモリ 203,088 KB
実行使用メモリ 11,132 KB
最終ジャッジ日時 2023-09-21 09:44:48
合計ジャッジ時間 4,059 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 RE -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:33:20: 警告: ‘max1’ may be used uninitialized [-Wmaybe-uninitialized]
   33 |     cout << max1 + 1 << endl;
      |                    ^
main.cpp:16:14: 備考: ‘max1’ はここで定義されています
   16 |     ll n, m, max1;
      |              ^~~~

ソースコード

diff #

#include <bits/stdc++.h>
#include<iostream>
#include<map>
#include<vector>
#include <algorithm>
#include<math.h>
#include <iomanip>
#include<set>
#include <numeric>
#include<string>
using ll = long long;
using namespace std;

int main()
{
    ll n, m, max1;
    cin >> n >> m;
    vector<vector<ll>> s(n, vector<ll>(m));
    for (ll i = 0; i < n; i++) {
        string yn;
        cin >> yn;
        for (ll j = 0; j < m; j++) {
            if (yn[j] == 'x') s[i][j]++;
        }
    }
    for (ll i = 0; i < n; i++){
        ll sum1 = 0;
        for (ll j = 0; j < n; j++){
            sum1 += s[j][i];
        }
        max1 = max(max1, sum1);
    }
    cout << max1 + 1 << endl;
}
0