Submission #66168484
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#include <atcoder/all>
using namespace atcoder;
int main(){
int N; cin >> N;
vector<int> A(N), B(N);
int sa = 0, sb = 0;
for(int i = 0; i < N; i++){
cin >> A[i];
sa += A[i];
}
for(int i = 0; i < N; i++){
cin >> B[i];
sb += B[i];
}
if(sa != sb){
cout << "No" << endl;
return 0;
}
vector<pair<int, int>> ans;
for(int i = 0; i < N - 1; i++){
int crr = A[i], idx = i;
while(crr != B[i] + 1){
if(idx < N - 1){
ans.push_back({idx, idx + 1});
swap(A[idx], A[idx + 1]);
A[idx]--;
A[idx + 1]++;
crr++;
idx++;
}
else {
ans.push_back({i, idx});
swap(A[idx], A[i]);
crr--;
idx = i;
}
}
}
if(ans.size() > 31000){
cout << "No" << endl;
return 0;
}
cout << ans.size() << endl;
for(auto [a, b] : ans){
cout << a << " " << b << endl;
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - Error Swap |
| User | iphi7 |
| Language | C++ 23 (gcc 12.2) |
| Score | 0 |
| Code Size | 1211 Byte |
| Status | WA |
| Exec Time | 2321 ms |
| Memory | 2101860 KiB |
Judge Result
| Set Name | Sample | All | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 700 | ||||||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example_00.txt, example_01.txt, example_02.txt |
| All | example_00.txt, example_01.txt, example_02.txt, test_00.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt, test_44.txt, test_45.txt, test_46.txt, test_47.txt, test_48.txt, test_49.txt, test_50.txt, test_51.txt, test_52.txt, test_53.txt, test_54.txt, test_55.txt, test_56.txt, test_57.txt, test_58.txt, test_59.txt, test_60.txt, test_61.txt, test_62.txt, test_63.txt, test_64.txt, test_65.txt, test_66.txt, test_67.txt, test_68.txt, test_69.txt, test_70.txt, test_71.txt, test_72.txt, test_73.txt, test_74.txt, test_75.txt, test_76.txt, test_77.txt, test_78.txt, test_79.txt, test_80.txt, test_81.txt, test_82.txt, test_83.txt, test_84.txt, test_85.txt, test_86.txt, test_87.txt, test_88.txt, test_89.txt, test_90.txt, test_91.txt, test_92.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| example_00.txt | WA | 1 ms | 3564 KiB |
| example_01.txt | AC | 1 ms | 3632 KiB |
| example_02.txt | WA | 1 ms | 3500 KiB |
| test_00.txt | AC | 1 ms | 3448 KiB |
| test_01.txt | WA | 1 ms | 3640 KiB |
| test_02.txt | TLE | 2284 ms | 2101860 KiB |
| test_03.txt | AC | 5 ms | 3656 KiB |
| test_04.txt | AC | 1 ms | 3496 KiB |
| test_05.txt | AC | 1 ms | 3496 KiB |
| test_06.txt | AC | 1 ms | 3488 KiB |
| test_07.txt | AC | 1 ms | 3548 KiB |
| test_08.txt | TLE | 2320 ms | 2088012 KiB |
| test_09.txt | TLE | 2302 ms | 2101824 KiB |
| test_10.txt | TLE | 2320 ms | 2071004 KiB |
| test_11.txt | TLE | 2317 ms | 2016196 KiB |
| test_12.txt | TLE | 2319 ms | 2065848 KiB |
| test_13.txt | TLE | 2319 ms | 2085488 KiB |
| test_14.txt | TLE | 2261 ms | 2101764 KiB |
| test_15.txt | TLE | 2319 ms | 2101800 KiB |
| test_16.txt | TLE | 2321 ms | 2097748 KiB |
| test_17.txt | TLE | 2321 ms | 2097220 KiB |
| test_18.txt | TLE | 2296 ms | 2101724 KiB |
| test_19.txt | TLE | 2272 ms | 2101736 KiB |
| test_20.txt | TLE | 2315 ms | 2101756 KiB |
| test_21.txt | TLE | 2266 ms | 2101784 KiB |
| test_22.txt | TLE | 2320 ms | 2095692 KiB |
| test_23.txt | TLE | 2271 ms | 2101800 KiB |
| test_24.txt | TLE | 2320 ms | 2087332 KiB |
| test_25.txt | TLE | 2269 ms | 2101780 KiB |
| test_26.txt | TLE | 2320 ms | 2036976 KiB |
| test_27.txt | TLE | 2321 ms | 2036984 KiB |
| test_28.txt | TLE | 2264 ms | 2101820 KiB |
| test_29.txt | TLE | 2267 ms | 2101844 KiB |
| test_30.txt | TLE | 2265 ms | 2101844 KiB |
| test_31.txt | TLE | 2265 ms | 2101796 KiB |
| test_32.txt | TLE | 2269 ms | 2101748 KiB |
| test_33.txt | TLE | 2262 ms | 2101772 KiB |
| test_34.txt | TLE | 2264 ms | 2101764 KiB |
| test_35.txt | TLE | 2284 ms | 2101788 KiB |
| test_36.txt | TLE | 2267 ms | 2101808 KiB |
| test_37.txt | TLE | 2267 ms | 2101804 KiB |
| test_38.txt | TLE | 2284 ms | 2101836 KiB |
| test_39.txt | TLE | 2265 ms | 2101748 KiB |
| test_40.txt | TLE | 2263 ms | 2101752 KiB |
| test_41.txt | TLE | 2289 ms | 2101832 KiB |
| test_42.txt | TLE | 2265 ms | 2101840 KiB |
| test_43.txt | TLE | 2264 ms | 2101848 KiB |
| test_44.txt | TLE | 2266 ms | 2101804 KiB |
| test_45.txt | TLE | 2274 ms | 2101736 KiB |
| test_46.txt | TLE | 2263 ms | 2101768 KiB |
| test_47.txt | TLE | 2267 ms | 2101792 KiB |
| test_48.txt | TLE | 2274 ms | 2101768 KiB |
| test_49.txt | TLE | 2277 ms | 2101828 KiB |
| test_50.txt | TLE | 2285 ms | 2101796 KiB |
| test_51.txt | TLE | 2284 ms | 2101820 KiB |
| test_52.txt | TLE | 2278 ms | 2101792 KiB |
| test_53.txt | TLE | 2277 ms | 2101732 KiB |
| test_54.txt | TLE | 2285 ms | 2101736 KiB |
| test_55.txt | TLE | 2285 ms | 2101836 KiB |
| test_56.txt | TLE | 2284 ms | 2101732 KiB |
| test_57.txt | TLE | 2284 ms | 2101748 KiB |
| test_58.txt | TLE | 2274 ms | 2101804 KiB |
| test_59.txt | TLE | 2285 ms | 2101752 KiB |
| test_60.txt | TLE | 2284 ms | 2101760 KiB |
| test_61.txt | TLE | 2318 ms | 2024092 KiB |
| test_62.txt | TLE | 2318 ms | 2032596 KiB |
| test_63.txt | TLE | 2317 ms | 2030628 KiB |
| test_64.txt | TLE | 2317 ms | 2027804 KiB |
| test_65.txt | TLE | 2318 ms | 2033144 KiB |
| test_66.txt | TLE | 2318 ms | 2028488 KiB |
| test_67.txt | TLE | 2317 ms | 2029544 KiB |
| test_68.txt | TLE | 2318 ms | 2035620 KiB |
| test_69.txt | TLE | 2317 ms | 2029240 KiB |
| test_70.txt | TLE | 2318 ms | 2038548 KiB |
| test_71.txt | TLE | 2317 ms | 2032796 KiB |
| test_72.txt | TLE | 2317 ms | 2027280 KiB |
| test_73.txt | TLE | 2317 ms | 2026984 KiB |
| test_74.txt | TLE | 2321 ms | 2039244 KiB |
| test_75.txt | TLE | 2321 ms | 2039492 KiB |
| test_76.txt | TLE | 2317 ms | 2021788 KiB |
| test_77.txt | TLE | 2318 ms | 2037116 KiB |
| test_78.txt | TLE | 2317 ms | 2031252 KiB |
| test_79.txt | TLE | 2321 ms | 2034724 KiB |
| test_80.txt | TLE | 2317 ms | 2033016 KiB |
| test_81.txt | TLE | 2317 ms | 2019056 KiB |
| test_82.txt | TLE | 2317 ms | 2026172 KiB |
| test_83.txt | TLE | 2317 ms | 2032420 KiB |
| test_84.txt | TLE | 2317 ms | 2025792 KiB |
| test_85.txt | TLE | 2321 ms | 2042944 KiB |
| test_86.txt | TLE | 2317 ms | 2023060 KiB |
| test_87.txt | TLE | 2318 ms | 2031508 KiB |
| test_88.txt | TLE | 2318 ms | 2040112 KiB |
| test_89.txt | TLE | 2318 ms | 2036496 KiB |
| test_90.txt | TLE | 2318 ms | 2038280 KiB |
| test_91.txt | TLE | 2317 ms | 2016764 KiB |
| test_92.txt | TLE | 2318 ms | 2040676 KiB |