結果

問題 No.547 未知の言語
コンテスト
ユーザー hamray
提出日時 2017-11-04 17:58:27
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 563 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 526 ms
コンパイル使用メモリ 80,064 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2026-03-12 16:31:45
合計ジャッジ時間 1,379 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:24:13: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
   24 |     cout << ans << endl;
      |             ^~~
main.cpp:9:9: note: 'ans' was declared here
    9 |     int ans;
      |         ^~~

ソースコード

diff #
raw source code

#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(){
    int N; cin >> N;
    vector<string> v1;
    vector<string> v2;
    int ans;
    for(int i = 0; i < N; i++){
        string a;
        cin >> a;
        v1.push_back(a);
    }
    for(int i = 0; i < N; i++){
        string a;
        cin >> a;
        v2.push_back(a);
    }
    for(int i = 0; i < N; i++){
        if(v1[i] != v2[i])
            ans = i + 1;
    }
    cout << ans << endl;
    cout << v1[ans - 1] << endl;
    cout << v2[ans - 1] << endl;
    return 0;
}
0