結果
| 問題 | No.70 睡眠の重要性! | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2019-08-21 21:55:25 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                WA
                                 
                            (最新) 
                                AC
                                 
                            (最初) | 
| 実行時間 | - | 
| コード長 | 582 bytes | 
| コンパイル時間 | 1,536 ms | 
| コンパイル使用メモリ | 166,184 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-10-09 20:26:21 | 
| 合計ジャッジ時間 | 2,449 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | WA * 6 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:23:11: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   23 |     cout<<ans<<endl;
      |           ^~~
            
            ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,ans;
    cin>>n;
    vector<vector<int>> a(n),b(n);
    for(int i=0;i<n;++i){
        string s,t,tmp;
        cin>>s>>t;
        istringstream ss(s),st(t);
        while(getline(ss,tmp,':')){
            a[i].emplace_back(stoi(tmp));
        }
        while(getline(st,tmp,':')){
            b[i].emplace_back(stoi(tmp));
        }
    }
    for(int i=0;i<n;++i){
        int ta=60*a[i].front()+a[i].back(),tb=60*b[i].front()+b[i].back();
        if(ta>tb)tb+=60*24;
        ans+=tb-ta;
    }
    cout<<ans<<endl;
}
            
            
            
        