QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#149729 | #6660. 택시 여행 | penguinman# | Compile Error | / | / | C++17 | 1.4kb | 2023-08-25 13:19:35 | 2024-05-26 00:10:04 |
Judging History
answer
#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::string;
using ll = long long;
using vi = vector<ll>;
using vii = vector<vi>;
using pii = std::pair<ll,ll>;
#define rep(i,j,k) for(ll i=ll(j); i<ll(k); i++)
#define REP(i,j,k) for(ll i=ll(j); i<=ll(k); i++)
#define per(i,j,k) for(ll i=ll(j); i>=ll(k); i--)
#define ln "\n"
#define pb emplace_back
#define mp std::make_pair
#define mtp std::make_tuple
#define all(a) a.begin(),a.end()
constexpr ll inf = 1e18;
int main(){
ll N; cin >> N;
vi A(N);
// g
cin >> A[0];
rep(i,0,N) cin >> A[i];
auto count = [&](vi a){
ll cnt = 0;
while(*min_element(all(a)) < 0){
rep(i,1,N){
a[i] += a[i-1];
a[i] = std::max(a[i], -inf);
a[i] = std::min(a[i], inf);
}
cnt++;
}
return cnt;
};
vi t, l, r;
rep(i,0,N){
if(A[i]){
if(A[i] < 0){
t.pb(1);
l.pb(0);
r.pb(0);
rep(j,0,N) A[j] *= -1;
}
break;
}
}
ll cnt = count(A);
rep(i,0,cnt){
t.pb(2);
l.pb(1);
r.pb(N);
}
cout << t.size() << ln;
rep(i,0,t.size()){
cout << t[i] << " " << l[i] << " " << r[i] << ln;
}
}
詳細信息
/usr/bin/ld: /tmp/ccch64wE.o: in function `main': answer.code:(.text.startup+0x0): multiple definition of `main'; /tmp/cc40e7VD.o:implementer.cpp:(.text.startup+0x0): first defined here /usr/bin/ld: /tmp/cc40e7VD.o: in function `main': implementer.cpp:(.text.startup+0x35e): 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