結果

問題 No.851 テストケース
ユーザー outline
提出日時 2020-03-26 21:34:26
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 3,153 ms
コード長 1,652 bytes
コンパイル時間 1,188 ms
コンパイル使用メモリ 115,172 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2025-01-02 03:07:52
合計ジャッジ時間 2,051 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<int, pair<int, int>> PP;
typedef pair<P, int> PPi;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;
    cin.ignore();
    vector<ll> a;
    string s;
    for(int i = 0; i < n; ++i){
        getline(cin, s);
        stringstream ss(s);
        ll tmp;
        while(!ss.eof()){
            ss >> tmp;
            a.push_back(tmp);
        }
        if(a.size() != i + 1){
            cout << "\"assert\"\n";
            return 0;
        }
    }
    vector<ll> sum;
    sum.push_back(a[0] + a[1]);
    sum.push_back(a[1] + a[2]);
    sum.push_back(a[2] + a[0]);
    sort(sum.begin(), sum.end(), greater<ll>());
    sum.erase(unique(sum.begin(), sum.end()), sum.end());
    cout << sum[1] << endl;
}
0