結果

問題 No.2306 [Cherry 5th Tune C] ウソツキタマシイ
ユーザー kpinkcatkpinkcat
提出日時 2023-09-25 01:56:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,137 bytes
コンパイル時間 4,129 ms
コンパイル使用メモリ 202,428 KB
実行使用メモリ 8,752 KB
最終ジャッジ日時 2023-09-25 01:57:11
合計ジャッジ時間 11,545 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 116 ms
4,376 KB
testcase_03 AC 18 ms
4,376 KB
testcase_04 AC 159 ms
4,376 KB
testcase_05 AC 170 ms
4,380 KB
testcase_06 AC 208 ms
4,376 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

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;

string chadd(string sum, ll x){
    ll up = 0, tmp = 0;
    if (sum.size() >= 6){
        up = stoll(sum.substr(0, sum.size() - 5));
        tmp = stoll(sum.substr(sum.size() - 5));
    } else if (sum != "") tmp = stoll(sum);
    else tmp = 0;
    tmp += x;
    if (tmp >= 1e5){
        up += tmp/1e5;
        tmp = tmp%100000;
    }
    sum = "";
    if (up) sum += to_string(up);
    string stmp = to_string(tmp);
    stmp = std::string(std::max(0, 5-(int)stmp.size()), '0') + stmp;
    sum += stmp;
    return sum;
}

int main()
{
    int n, m, q;
    cin >> n >> m;
    vector<ll> a(m);
    for (int i = 0; i < m; i++) cin >> a[i];
    cin >> q;
    for (int i = 0; i < q; i++){
        ll c, k, d;
        string sum1 = "";
        cin >> c >> k >> d;
        a[c-1] -= k;
        a[d-1] += k;
        for (auto x : a){
            sum1 = chadd(sum1, x*x);
        }
        cout << sum1 << endl;
    }
}

0