提出 #66808656
ソースコード 拡げる
// ↘ ⬇ ⬇ ⬇ ⬇ ⬇ ↙ // ➡ @roadfromroi ⬅ // ↗ ⬆ ⬆ ⬆ ⬆ ⬆ ↖ /* ░░░░░░░█▐▓▓░████▄▄▄█▀▄▓▓▓▌█ ░░░░░▄█▌▀▄▓▓▄▄▄▄▀▀▀▄▓▓▓▓▓▌█ ░░░▄█▀▀▄▓█▓▓▓▓▓▓▓▓▓▓▓▓▀░▓▌█ ░░█▀▄▓▓▓███▓▓▓███▓▓▓▄░░▄▓▐█▌ ░█▌▓▓▓▀▀▓▓▓▓███▓▓▓▓▓▓▓▄▀▓▓▐█ ▐█▐██▐░▄▓▓▓▓▓▀▄░▀▓▓▓▓▓▓▓▓▓▌█▌ █▌███▓▓▓▓▓▓▓▓▐░░▄▓▓███▓▓▓▄▀▐█ █▐█▓▀░░▀▓▓▓▓▓▓▓▓▓██████▓▓▓▓▐█ ▌▓▄▌▀░▀░▐▀█▄▓▓██████████▓▓▓▌█▌ ▌▓▓▓▄▄▀▀▓▓▓▀▓▓▓▓▓▓▓▓█▓█▓█▓▓▌█▌ █▐▓▓▓▓▓▓▄▄▄▓▓▓▓▓▓█▓█▓█▓█▓▓▓▐█ йоу */ #include "queue" #include <iostream> #include "vector" #include "algorithm" #include "numeric" #include "climits" #include "iomanip" #include "bitset" #include "cmath" #include "map" #include "deque" #include "array" #include "set" #include "ranges" #define all(x) x.begin(), x.end() using namespace std; #define int long long void solve() { int n=2; cin >> n; vector<pair<int, int>> a(n); for (int i = 0; i < n; ++i) { a[i].first = rand() % 100000 + 1; cin >> a[i].first; } for (int i = 0; i < n; ++i) { a[i].second = rand() % 100000 + 1; cin >> a[i].second; } vector<int> ans(n); bool ok = 0; for (int i = 1; i < n; ++i) { if (a[0].first * a[i].second != a[0].second * a[i].first) { int v = 0, u = i; if (a[0].first * a[i].second < a[0].second * a[i].first) swap(v, u); int p1 = 0, p2 = 0; p1 = a[u].first + a[u].second, p2 = -a[v].first - a[v].second; int bdmn = a[v].second * p1 + p2 * a[u].second; //p1++; ans[v] = p1; ans[u] = p2; ok = 1; break; } } if (ok == 0) { cout << "No\n"; } else { cout << "Yes\n"; int sma = 0, smb = 0; for (int i = 0; i < n; ++i) { sma += ans[i] * a[i].first; smb += ans[i] * a[i].second; if (ans[i] > 1e8) { for (auto i : a) cout << i.first << ' ' << i.second<<'\n'; exit(1); } cout << ans[i] << ' '; } //cout << sma << ' ' << smb << '\n'; if (sma <= 0 or smb >= 0) exit(2); cout << '\n'; } } signed main() { ios::sync_with_stdio(0); cin.tie(0);cout.tie(0); int t=1; cin >> t; while (t--) { solve(); } } /* 1 2 49464 69440 49412 69367 */
提出情報
提出日時 | |
---|---|
問題 | A - Dot Product |
ユーザ | SomethingNew |
言語 | C++ 20 (gcc 12.2) |
得点 | 500 |
コード長 | 3089 Byte |
結果 | AC |
実行時間 | 38 ms |
メモリ | 6748 KiB |
コンパイルエラー
Main.cpp: In function ‘void solve()’: Main.cpp:56:17: warning: unused variable ‘bdmn’ [-Wunused-variable] 56 | int bdmn = a[v].second * p1 + p2 * a[u].second; | ^~~~
ジャッジ結果
セット名 | Sample | All | ||||
---|---|---|---|---|---|---|
得点 / 配点 | 0 / 0 | 500 / 500 | ||||
結果 |
|
|
セット名 | テストケース |
---|---|
Sample | 00_sample_00.txt |
All | 00_sample_00.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 01_handmade_06.txt, 01_handmade_07.txt, 01_handmade_08.txt, 01_handmade_09.txt, 01_handmade_10.txt, 01_handmade_11.txt, 01_handmade_12.txt, 01_handmade_13.txt, 01_handmade_14.txt, 01_handmade_15.txt, 01_handmade_16.txt, 01_handmade_17.txt, 01_handmade_18.txt, 01_handmade_19.txt, 01_handmade_20.txt, 01_handmade_21.txt, 01_handmade_22.txt, 01_handmade_23.txt, 01_handmade_24.txt, 01_handmade_25.txt, 02_No_00.txt, 02_No_01.txt, 02_No_02.txt, 02_No_03.txt, 03_Yes_00.txt, 03_Yes_01.txt, 03_Yes_02.txt, 03_Yes_03.txt, 03_Yes_04.txt, 03_Yes_05.txt, 03_Yes_06.txt, 03_Yes_07.txt, 04_YesNo_00.txt, 04_YesNo_01.txt, 04_YesNo_02.txt, 04_YesNo_03.txt, 04_YesNo_04.txt, 04_YesNo_05.txt |
ケース名 | 結果 | 実行時間 | メモリ |
---|---|---|---|
00_sample_00.txt | AC | 1 ms | 3400 KiB |
01_handmade_00.txt | AC | 1 ms | 3488 KiB |
01_handmade_01.txt | AC | 35 ms | 3412 KiB |
01_handmade_02.txt | AC | 35 ms | 3476 KiB |
01_handmade_03.txt | AC | 35 ms | 3468 KiB |
01_handmade_04.txt | AC | 35 ms | 3368 KiB |
01_handmade_05.txt | AC | 35 ms | 3448 KiB |
01_handmade_06.txt | AC | 34 ms | 3476 KiB |
01_handmade_07.txt | AC | 33 ms | 3472 KiB |
01_handmade_08.txt | AC | 33 ms | 3472 KiB |
01_handmade_09.txt | AC | 33 ms | 3460 KiB |
01_handmade_10.txt | AC | 33 ms | 3472 KiB |
01_handmade_11.txt | AC | 33 ms | 3488 KiB |
01_handmade_12.txt | AC | 33 ms | 3476 KiB |
01_handmade_13.txt | AC | 33 ms | 3356 KiB |
01_handmade_14.txt | AC | 37 ms | 3540 KiB |
01_handmade_15.txt | AC | 36 ms | 3484 KiB |
01_handmade_16.txt | AC | 36 ms | 3480 KiB |
01_handmade_17.txt | AC | 36 ms | 3472 KiB |
01_handmade_18.txt | AC | 34 ms | 3480 KiB |
01_handmade_19.txt | AC | 38 ms | 3536 KiB |
01_handmade_20.txt | AC | 33 ms | 3552 KiB |
01_handmade_21.txt | AC | 33 ms | 3404 KiB |
01_handmade_22.txt | AC | 31 ms | 3484 KiB |
01_handmade_23.txt | AC | 30 ms | 3608 KiB |
01_handmade_24.txt | AC | 31 ms | 3484 KiB |
01_handmade_25.txt | AC | 26 ms | 3548 KiB |
02_No_00.txt | AC | 33 ms | 3488 KiB |
02_No_01.txt | AC | 27 ms | 3496 KiB |
02_No_02.txt | AC | 22 ms | 6212 KiB |
02_No_03.txt | AC | 21 ms | 4928 KiB |
03_Yes_00.txt | AC | 38 ms | 3472 KiB |
03_Yes_01.txt | AC | 38 ms | 3348 KiB |
03_Yes_02.txt | AC | 27 ms | 6320 KiB |
03_Yes_03.txt | AC | 27 ms | 5380 KiB |
03_Yes_04.txt | AC | 27 ms | 6740 KiB |
03_Yes_05.txt | AC | 27 ms | 6748 KiB |
03_Yes_06.txt | AC | 34 ms | 3492 KiB |
03_Yes_07.txt | AC | 32 ms | 3544 KiB |
04_YesNo_00.txt | AC | 34 ms | 3556 KiB |
04_YesNo_01.txt | AC | 32 ms | 3500 KiB |
04_YesNo_02.txt | AC | 35 ms | 3496 KiB |
04_YesNo_03.txt | AC | 33 ms | 3472 KiB |
04_YesNo_04.txt | AC | 35 ms | 3472 KiB |
04_YesNo_05.txt | AC | 32 ms | 3456 KiB |