QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#149730 | #6718. Масив i частковi суми | penguinman# | 0 | 21ms | 6268kb | C++17 | 1.4kb | 2023-08-25 13:19:53 | 2024-05-26 00:10:10 |
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;
}
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 14
Accepted
time: 19ms
memory: 6224kb
input:
200000 1 1 1 0 0 1 0 1 0 0 0 0 1 1 0 1 0 1 1 0 1 1 0 0 1 1 1 0 0 1 1 1 1 0 1 0 1 1 1 1 1 0 1 0 1 0 1 1 0 0 1 1 1 0 0 1 0 0 0 1 0 0 1 0 1 0 0 0 1 0 0 1 0 0 1 1 0 1 0 0 1 0 0 0 0 1 0 0 1 1 1 1 1 0 0 0 1 1 0 1 1 1 1 1 1 0 0 0 1 1 0 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 1 0 1 0 1 1 1 1 1 1 0 1 1 1 0 1 1 1 0 0 0...
output:
0
result:
ok OK: 0 operations
Test #2:
score: -14
Wrong Answer
time: 21ms
memory: 6228kb
input:
200000 1 -1 0 0 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 0 -1 -1 0 -1 -1 0 0 0 -1 -1 0 -1 0 -1 0 -1 0 -1 -1 0 0 -1 -1 0 0 -1 -1 0 -1 -1 -1 -1 0 -1 -1 0 0 0 -1 0 -1 -1 -1 0 -1 -1 0 0 0 -1 -1 -1 -1 -1 0 0 -1 -1 0 -1 0 -1 0 -1 -1 -1 0 -1 -1 0 0 0 0 -1 -1 -1 0 0 -1 -1 -1 0 0 -1 -1 -1 0 0 -1 -1 -1 0 -...
output:
1 1 0 0
result:
wrong output format Extra information in the output file
Subtask #2:
score: 0
Wrong Answer
Test #5:
score: 17
Accepted
time: 15ms
memory: 6220kb
input:
200000 2 1 1 0 0 1 0 1 0 1 1 0 1 1 1 1 0 0 0 1 1 0 0 0 1 1 0 1 0 0 0 0 0 1 0 1 0 0 1 0 1 1 1 0 0 1 1 0 0 0 0 0 0 1 1 0 1 1 0 1 0 1 0 1 1 1 0 0 1 0 0 1 1 1 1 0 0 0 0 1 1 0 0 0 1 1 0 1 0 1 1 0 0 0 0 1 1 0 1 1 1 1 0 0 0 0 1 0 0 1 0 0 0 1 1 1 0 0 1 1 0 1 1 0 1 1 1 0 0 1 0 0 0 0 0 1 1 0 0 0 1 1 0 1 0 1 0...
output:
0
result:
ok OK: 0 operations
Test #6:
score: -17
Wrong Answer
time: 21ms
memory: 6268kb
input:
200000 2 0 0 -1 -1 0 -1 0 0 -1 -1 0 -1 -1 0 -1 0 -1 -1 -1 -1 -1 0 0 -1 0 -1 -1 0 0 -1 -1 -1 -1 -1 -1 -1 -1 0 0 -1 -1 0 -1 -1 -1 0 -1 0 -1 0 -1 0 0 0 0 0 0 0 0 0 0 -1 0 -1 0 -1 0 0 0 -1 -1 0 0 -1 -1 -1 0 -1 -1 0 -1 -1 -1 -1 0 -1 -1 -1 0 0 -1 0 0 0 -1 -1 -1 0 0 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 0 0 0 -1 -1...
output:
1 1 0 0
result:
wrong output format Extra information in the output file
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Skipped
Dependency #3:
0%
Subtask #5:
score: 0
Wrong Answer
Test #28:
score: 0
Wrong Answer
time: 11ms
memory: 3684kb
input:
2891 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 ...
output:
2049 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 2891 2 1 289...
result:
wrong answer Integer parameter [name=Number of operations] equals to 2049, violates the range [0, 100]
Subtask #6:
score: 0
Skipped
Dependency #5:
0%
Subtask #7:
score: 0
Skipped
Dependency #5:
0%
Subtask #8:
score: 0
Skipped
Dependency #1:
0%