結果
問題 | No.2306 [Cherry 5th Tune C] ウソツキタマシイ |
ユーザー | kpinkcat |
提出日時 | 2023-09-25 02:20:30 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 249 ms / 2,000 ms |
コード長 | 1,217 bytes |
コンパイル時間 | 2,030 ms |
コンパイル使用メモリ | 199,876 KB |
実行使用メモリ | 4,500 KB |
最終ジャッジ日時 | 2023-09-25 02:20:40 |
合計ジャッジ時間 | 9,032 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,384 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 3 ms
4,500 KB |
testcase_03 | AC | 2 ms
4,380 KB |
testcase_04 | AC | 4 ms
4,376 KB |
testcase_05 | AC | 4 ms
4,380 KB |
testcase_06 | AC | 3 ms
4,380 KB |
testcase_07 | AC | 156 ms
4,376 KB |
testcase_08 | AC | 31 ms
4,376 KB |
testcase_09 | AC | 90 ms
4,380 KB |
testcase_10 | AC | 91 ms
4,380 KB |
testcase_11 | AC | 106 ms
4,376 KB |
testcase_12 | AC | 137 ms
4,380 KB |
testcase_13 | AC | 92 ms
4,376 KB |
testcase_14 | AC | 77 ms
4,380 KB |
testcase_15 | AC | 195 ms
4,376 KB |
testcase_16 | AC | 205 ms
4,380 KB |
testcase_17 | AC | 246 ms
4,376 KB |
testcase_18 | AC | 249 ms
4,376 KB |
testcase_19 | AC | 249 ms
4,376 KB |
testcase_20 | AC | 248 ms
4,376 KB |
testcase_21 | AC | 240 ms
4,380 KB |
testcase_22 | AC | 249 ms
4,380 KB |
testcase_23 | AC | 241 ms
4,376 KB |
testcase_24 | AC | 240 ms
4,376 KB |
testcase_25 | AC | 242 ms
4,380 KB |
testcase_26 | AC | 241 ms
4,376 KB |
testcase_27 | AC | 220 ms
4,376 KB |
testcase_28 | AC | 218 ms
4,376 KB |
testcase_29 | AC | 204 ms
4,376 KB |
ソースコード
#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); if (up) stmp = std::string(std::max(0, 5-(int)stmp.size()), '0') + stmp; sum += stmp; return sum; } */ int main() { ll n, m, q, sum1 = 0; cin >> n >> m; vector<ll> a(m); for (int i = 0; i < m; i++) cin >> a[i]; cin >> q; for (auto x : a) sum1 += x*x; 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; sum1 += (a[c-1]*a[c-1] + a[d-1]*a[d-1] -(a[c-1]+k)*(a[c-1]+k) -(a[d-1]-k)*(a[d-1]-k)); cout << sum1 << "\n"; } }