QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#186862 | #6660. 택시 여행 | Cyanmond | Compile Error | / | / | C++17 | 1.6kb | 2023-09-24 12:44:25 | 2023-09-24 12:44:26 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define rep(i, l, r) for (int i = (l); i < (r); ++i)
#define per(i, l, r) for (int i = (r - 1); i >= l; --i)
#define ALL(x) (x).begin(), (x).end()
using i64 = long long;
void main_() {
int N, G;
cin >> N >> G;
vector<i64> A(N);
for (auto &e : A) cin >> e;
if (G == 2) {
i64 f = 0;
for (const auto e : A) {
if (e != 0) {
f = e;
break;
}
}
if (f == 0) {
cout << 0 << endl;
} else {
if (f == 1) {
cout << 100 << endl;
rep(i, 0, 100) cout << 2 << ' ' << 1 << ' ' << N << endl;
} else {
cout << 100 << endl;
rep(i, 0, 99) cout << 2 << ' ' << 1 << ' ' << N << endl;
cout << 1 << endl;
}
}
}
if (G == 5) {
vector<pair<int, int>> ans;
while (any_of(ALL(A), [](i64 x) { return x < 0; })) {
__int128_t sum = 0;
int r = N - 1;
rep(i, 0, N) {
sum += A[i];
if (sum < A[i]) {
r = i - 1;
break;
} else {
A[i] = sum;
}
}
ans.push_back({0, r});
}
cout << ans.size() << endl;
for (const auto &[a, b] : ans) cout << 2 << ' ' << a + 1 << ' ' << b + 1 << endl;
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
main_();
}
Details
/usr/bin/ld: /tmp/cco1J4vF.o: in function `main': answer.code:(.text.startup+0x0): multiple definition of `main'; /tmp/ccmfKGeH.o:implementer.cpp:(.text.startup+0x0): first defined here /usr/bin/ld: /tmp/ccmfKGeH.o: in function `main': implementer.cpp:(.text.startup+0x345): undefined reference to `travel(std::vector<long long, std::allocator<long long> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)' collect2: error: ld returned 1 exit status