Submission #495872

# Submission time Handle Problem Language Result Execution time Memory
495872 2021-12-20T06:41:51 Z Nuraly_Serikbay Nice sequence (IZhO18_sequence) C++14
6 / 100
1 ms 204 KB
#include <bits/stdc++.h>
  
#define endl "\n"
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define sz size()
#define rep(i,k,n) for(int i = k ; i <= n ; ++i)
#define per(i,k,n) for(int i = k ; i >= n ; --i)
#define Zymraq() ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define all(x) x.begin(),x.end()
#define fr(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout)
#define toqta return 0
#define PERMUTE next_permutation
#define no cout<<"No"<<endl;
#define yes cout<<"Yes"<<endl;
#define a() a + 1, a + n + 1  
 
  
using namespace std;
   
typedef long long ll;
typedef unsigned long long ull;
typedef string S;
typedef double ld;
typedef long double lld;
   
const int N = 1e6 + 17;
const int modd = 1e9 + 7;
const int INF = 1e9 - 19;
const int P = 37;
const ll NN = 1e7 + 17;
const ld eps = 1e-19;
const double pi = 3.141592653589793238462643383279 ;
   
 
bool sortbysec(const pair<int,int> &a, const pair<int,int> &b){
    return (a.second < b.second);
}
 
void pre (ll a) {
    cout << fixed << setprecision(a);
    return;
} 



int main () {
	ll t;
	cin >> t;
	while (t --) {
		ll n, m;
		cin >> n >> m;
		if (n == 2 && n < m && m % n != 0)  {
			ll l = (m / 2 + m), r = 0 - (l + 1);
			for (int i = 1; i <=m / 2; ++ i) {
				cout << l << ' ' << r << ' ';
				l -= 2, r += 2;
			}
			cout << l << '\n';
			continue;
		}
		if (m == 2 && n > m && n % m != 0) {
			ll l = 0 - (n / 2 + n), r = n / 2 + n + 1;
			for (int i = 1; i <= n / 2; ++ i) {
				cout << l << ' ' << r << ' ';
				r -= 2;
				l += 2;
			}
			cout << l << '\n';
			continue;
		}
		if (n == m) {
			cout << n - 1 << '\n';
			for (int i = 1; i < n; ++ i) {
				cout << i << ' ';
			}
			cout << '\n';
			continue;
		}
		if (n > m) {
			cout << n - 1 << '\n';
			for (int i = 1; i < n; ++ i) {
				cout << i << ' ';
			}
			cout << '\n';
		} else if (m > n){
			cout << m - 1 << '\n';
			for (int i = 1; i < m; ++ i) {
				cout << 0 - i << ' ';
			}
			cout << '\n';
		}
		
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Ok
2 Correct 0 ms 204 KB Ok
3 Correct 0 ms 204 KB Ok
4 Correct 1 ms 204 KB Ok
5 Correct 1 ms 204 KB Ok
6 Correct 1 ms 204 KB Ok
7 Correct 0 ms 204 KB Ok
8 Correct 0 ms 204 KB Ok
9 Correct 1 ms 204 KB Ok
10 Correct 1 ms 204 KB Ok
11 Correct 1 ms 204 KB Ok
12 Correct 1 ms 204 KB Ok
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Jury has the better answer : jans = 3, pans = -4
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB All the numbers must be nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB there is incorrect sequence
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Ok
2 Correct 0 ms 204 KB Ok
3 Correct 0 ms 204 KB Ok
4 Correct 1 ms 204 KB Ok
5 Correct 1 ms 204 KB Ok
6 Correct 1 ms 204 KB Ok
7 Correct 0 ms 204 KB Ok
8 Correct 0 ms 204 KB Ok
9 Correct 1 ms 204 KB Ok
10 Correct 1 ms 204 KB Ok
11 Correct 1 ms 204 KB Ok
12 Correct 1 ms 204 KB Ok
13 Incorrect 1 ms 204 KB All the numbers must be nonzero
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Ok
2 Correct 0 ms 204 KB Ok
3 Correct 0 ms 204 KB Ok
4 Correct 1 ms 204 KB Ok
5 Correct 1 ms 204 KB Ok
6 Correct 1 ms 204 KB Ok
7 Correct 0 ms 204 KB Ok
8 Correct 0 ms 204 KB Ok
9 Correct 1 ms 204 KB Ok
10 Correct 1 ms 204 KB Ok
11 Correct 1 ms 204 KB Ok
12 Correct 1 ms 204 KB Ok
13 Incorrect 0 ms 204 KB Jury has the better answer : jans = 3, pans = -4
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Ok
2 Correct 0 ms 204 KB Ok
3 Correct 0 ms 204 KB Ok
4 Correct 1 ms 204 KB Ok
5 Correct 1 ms 204 KB Ok
6 Correct 1 ms 204 KB Ok
7 Correct 0 ms 204 KB Ok
8 Correct 0 ms 204 KB Ok
9 Correct 1 ms 204 KB Ok
10 Correct 1 ms 204 KB Ok
11 Correct 1 ms 204 KB Ok
12 Correct 1 ms 204 KB Ok
13 Incorrect 0 ms 204 KB Jury has the better answer : jans = 3, pans = -4
14 Halted 0 ms 0 KB -