結果

問題 No.70 睡眠の重要性!
ユーザー maicunemaicune
提出日時 2019-08-21 21:55:25
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 582 bytes
コンパイル時間 2,291 ms
コンパイル使用メモリ 164,572 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-18 02:44:20
合計ジャッジ時間 1,987 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
      |           ^~~

ソースコード

diff #

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