# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1032493 | 2024-07-23T21:07:28 Z | hasan2006 | Nice sequence (IZhO18_sequence) | C++17 | 4 ms | 980 KB |
#include <bits/stdc++.h> using namespace std; #define TL ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); #define rall(s) s.rbegin(),s.rend() #define all(s) s.begin(),s.end() #define pb push_back #define se second #define fi first #define ll long long #define ld long double #define YES cout<<"YES\n" #define Yes cout<<"Yes\n" #define yes cout<<"yes\n" #define NO cout<<"NO\n" #define No cout<<"No\n" #define no cout<<"no\n" const int N = 1e5 + 9 , mod = 1e9 + 7; ll a[N] , b[N] , dp[N] , c[N] ,d[N] ; void solve() { ll n , q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ; cin>>n>>m; if(n == m && n > 1){ cout<<n - 1<<"\n"; for(i = 1; i < n; i++) cout<<i<<" "; cout<<"\n"; return; } if(m > 1 && m % n == 1){ cout<<m<<"\n"; for(i = 1; i <= m; i++){ if(i % n) cout<<200000<<" "; else cout<<-200001<<" "; } cout<<"\n"; return; } if(n > 1 && n % m == 1){ cout<<n<<"\n"; for(i = 1; i <= n; i++){ if(i % m) cout<<-200000<<" "; else cout<<200001<<" "; } cout<<"\n"; return; } if(n < m && m > 1){ cout<<m - 1<<"\n"; for(i = 1; i < m; i++) cout<<-1<<" "; cout<<"\n"; return; } if(n >= m && n > 1 ){ cout<<n - 1<<"\n"; for(i = 1; i < n; i++) cout<<i<<" "; cout<<"\n"; return; } cout<<0<<"\n"; } int main(){ TL; /*#ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif*/ int t = 1; cin>>t; while(t--) { solve(); } } // Author : حسن
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Ok |
2 | Correct | 0 ms | 348 KB | Ok |
3 | Correct | 0 ms | 348 KB | Ok |
4 | Correct | 0 ms | 348 KB | Ok |
5 | Correct | 1 ms | 348 KB | Ok |
6 | Correct | 1 ms | 344 KB | Ok |
7 | Correct | 1 ms | 348 KB | Ok |
8 | Correct | 0 ms | 344 KB | Ok |
9 | Correct | 0 ms | 348 KB | Ok |
10 | Correct | 0 ms | 348 KB | Ok |
11 | Correct | 0 ms | 348 KB | Ok |
12 | Correct | 0 ms | 348 KB | Ok |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Ok |
2 | Correct | 1 ms | 348 KB | Ok |
3 | Correct | 0 ms | 348 KB | Ok |
4 | Correct | 0 ms | 348 KB | Ok |
5 | Correct | 0 ms | 348 KB | Ok |
6 | Correct | 1 ms | 344 KB | Ok |
7 | Correct | 4 ms | 856 KB | Ok |
8 | Correct | 2 ms | 604 KB | Ok |
9 | Correct | 4 ms | 980 KB | Ok |
10 | Correct | 3 ms | 856 KB | Ok |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Ok |
2 | Correct | 0 ms | 352 KB | Ok |
3 | Correct | 0 ms | 348 KB | Ok |
4 | Incorrect | 0 ms | 348 KB | Jury has the better answer : jans = 9, pans = 7 |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Jury has the better answer : jans = 5, pans = 4 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Ok |
2 | Correct | 0 ms | 348 KB | Ok |
3 | Correct | 0 ms | 348 KB | Ok |
4 | Correct | 0 ms | 348 KB | Ok |
5 | Correct | 1 ms | 348 KB | Ok |
6 | Correct | 1 ms | 344 KB | Ok |
7 | Correct | 1 ms | 348 KB | Ok |
8 | Correct | 0 ms | 344 KB | Ok |
9 | Correct | 0 ms | 348 KB | Ok |
10 | Correct | 0 ms | 348 KB | Ok |
11 | Correct | 0 ms | 348 KB | Ok |
12 | Correct | 0 ms | 348 KB | Ok |
13 | Correct | 0 ms | 348 KB | Ok |
14 | Correct | 0 ms | 352 KB | Ok |
15 | Correct | 0 ms | 348 KB | Ok |
16 | Incorrect | 0 ms | 348 KB | Jury has the better answer : jans = 9, pans = 7 |
17 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Ok |
2 | Correct | 0 ms | 348 KB | Ok |
3 | Correct | 0 ms | 348 KB | Ok |
4 | Correct | 0 ms | 348 KB | Ok |
5 | Correct | 1 ms | 348 KB | Ok |
6 | Correct | 1 ms | 344 KB | Ok |
7 | Correct | 1 ms | 348 KB | Ok |
8 | Correct | 0 ms | 344 KB | Ok |
9 | Correct | 0 ms | 348 KB | Ok |
10 | Correct | 0 ms | 348 KB | Ok |
11 | Correct | 0 ms | 348 KB | Ok |
12 | Correct | 0 ms | 348 KB | Ok |
13 | Correct | 0 ms | 348 KB | Ok |
14 | Correct | 1 ms | 348 KB | Ok |
15 | Correct | 0 ms | 348 KB | Ok |
16 | Correct | 0 ms | 348 KB | Ok |
17 | Correct | 0 ms | 348 KB | Ok |
18 | Correct | 1 ms | 344 KB | Ok |
19 | Correct | 4 ms | 856 KB | Ok |
20 | Correct | 2 ms | 604 KB | Ok |
21 | Correct | 4 ms | 980 KB | Ok |
22 | Correct | 3 ms | 856 KB | Ok |
23 | Correct | 0 ms | 348 KB | Ok |
24 | Correct | 0 ms | 352 KB | Ok |
25 | Correct | 0 ms | 348 KB | Ok |
26 | Incorrect | 0 ms | 348 KB | Jury has the better answer : jans = 9, pans = 7 |
27 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Ok |
2 | Correct | 0 ms | 348 KB | Ok |
3 | Correct | 0 ms | 348 KB | Ok |
4 | Correct | 0 ms | 348 KB | Ok |
5 | Correct | 1 ms | 348 KB | Ok |
6 | Correct | 1 ms | 344 KB | Ok |
7 | Correct | 1 ms | 348 KB | Ok |
8 | Correct | 0 ms | 344 KB | Ok |
9 | Correct | 0 ms | 348 KB | Ok |
10 | Correct | 0 ms | 348 KB | Ok |
11 | Correct | 0 ms | 348 KB | Ok |
12 | Correct | 0 ms | 348 KB | Ok |
13 | Correct | 0 ms | 348 KB | Ok |
14 | Correct | 1 ms | 348 KB | Ok |
15 | Correct | 0 ms | 348 KB | Ok |
16 | Correct | 0 ms | 348 KB | Ok |
17 | Correct | 0 ms | 348 KB | Ok |
18 | Correct | 1 ms | 344 KB | Ok |
19 | Correct | 4 ms | 856 KB | Ok |
20 | Correct | 2 ms | 604 KB | Ok |
21 | Correct | 4 ms | 980 KB | Ok |
22 | Correct | 3 ms | 856 KB | Ok |
23 | Correct | 0 ms | 348 KB | Ok |
24 | Correct | 0 ms | 352 KB | Ok |
25 | Correct | 0 ms | 348 KB | Ok |
26 | Incorrect | 0 ms | 348 KB | Jury has the better answer : jans = 9, pans = 7 |
27 | Halted | 0 ms | 0 KB | - |