# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
107149 | 2019-04-22T08:00:43 Z | Shafin666 | Nice sequence (IZhO18_sequence) | C++14 | 3 ms | 512 KB |
#include <bits/stdc++.h> #define mp make_pair #define pb push_back #define pii pair<ll, ll> #define read_input freopen("in.txt","r", stdin) #define print_output freopen("out.txt","w", stdout) typedef long long ll; typedef long double ld; using namespace std; int a[200005]; int main() { int tc, p = 1e5+10; cin >> tc; while(tc--) { int n, m; int mul = 1; cin >> n >> m; if(m < n) mul *= -1, swap(n, m); int delta = m-n; if(delta*2 >= m || n == 1 || m == 1) { if(n == 1 && m == 1) {cout << 0 << endl; continue;} cout << m-1 << endl; for(int i = 1; i < m; i++) cout << -1*mul << " "; cout << endl; continue; } for(int i = 1; i <= delta; i++) a[i] = p * mul; for(int i = m; i > m-delta; i--) a[i] = p * mul; int total = delta * p * 2 - 1, left = m - 2*delta; for(int i = delta+1; i < m-delta; i++) a[i] = total/left * -1 * mul; a[m-delta] = -1 * (total - (total/left)*(left-1)) * mul; for(int i = 1; i <= m; i++) cout << a[i] << " "; cout <<endl; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Ok |
2 | Correct | 3 ms | 256 KB | Ok |
3 | Incorrect | 2 ms | 384 KB | Jury has the better answer : jans = 93, pans = 0 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 512 KB | Jury has the better answer : jans = 1, pans = 0 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | All the numbers must be nonzero |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 384 KB | there is incorrect sequence |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Ok |
2 | Correct | 3 ms | 256 KB | Ok |
3 | Incorrect | 2 ms | 384 KB | Jury has the better answer : jans = 93, pans = 0 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Ok |
2 | Correct | 3 ms | 256 KB | Ok |
3 | Incorrect | 2 ms | 384 KB | Jury has the better answer : jans = 93, pans = 0 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Ok |
2 | Correct | 3 ms | 256 KB | Ok |
3 | Incorrect | 2 ms | 384 KB | Jury has the better answer : jans = 93, pans = 0 |
4 | Halted | 0 ms | 0 KB | - |