답안 #501261

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
501261 2022-01-02T17:07:50 Z dostigator Nice sequence (IZhO18_sequence) C++17
6 / 100
1 ms 332 KB
// author lox:(
#pragma GCC optimize("O3")
#pragma GCC target("popcnt")
#include <bits/stdc++.h>
using namespace std;
#define popcnt __builtin_popcount
#define all(a) a.begin(),a.end()
#define low_b lower_bound
#define up_b upper_bound
#define vii vector<pair<int,int>>
#define vll vector<pair<ll,ll>>
#define pii pair<int,int>
#define mii map<int,int>
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define endl '\n'
#define Y second
#define X first
typedef long double ld;
typedef long long ll;
const int dx[4]={1,-1,0,0},dy[4]={0,0,1,-1},col=107,N=3e5+777;
const ll mod=1e9+7,inf=1e18;
void fre_open(){freopen("file.in","r",stdin);freopen("file.out","w",stdout);}
ll binpow(ll n,ll k){if(k<0)return 0ll;if(k==0)return 1ll;if(k%2)return (binpow(n,k-1)*n)%mod;ll kk=binpow(n,k/2)%mod;return (kk*kk)%mod;}
void solve(){
	int n,m;
	cin>>n>>m;
	if(max(n,m)%min(n,m)==0){//correct;
	cout<<max(n,m)-1<<endl;
	if(n>m){
        for(int i=1; i<n; ++i)
            cout<<i<<' ';
        cout<<endl;
        return;
	}
	if(n<=m){
        for(int i=1; i<m; ++i)
            cout<<-i<<' ';
        cout<<endl;
        return;
	}
	return;
	}
    cout<<max(n,m)<<endl;
    if(n<m){
        for(int i=1; i<=m; ++i){
            if(i%2) cout<<5<<' ';
            else cout<<-6<<' ';
        }
        cout<<endl;
        return;
    }
    for(int i=1; i<=n; ++i){
        if(i%2==0) cout<<-5<<' ';
        else cout<<6<<' ';
    }
    cout<<endl;
    return;
}
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //fre_open
    ll tt=1;
    cin>>tt;
    while(tt--) solve();
}

Compilation message

sequence.cpp: In function 'void fre_open()':
sequence.cpp:26:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 | void fre_open(){freopen("file.in","r",stdin);freopen("file.out","w",stdout);}
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
sequence.cpp:26:53: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 | void fre_open(){freopen("file.in","r",stdin);freopen("file.out","w",stdout);}
      |                                              ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Ok
2 Correct 0 ms 204 KB Ok
3 Correct 1 ms 332 KB Ok
4 Correct 0 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 292 KB Ok
10 Correct 1 ms 204 KB Ok
11 Correct 1 ms 204 KB Ok
12 Correct 0 ms 204 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 312 KB there is incorrect sequence
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 312 KB Ok
2 Correct 0 ms 204 KB Ok
3 Incorrect 0 ms 204 KB there is incorrect sequence
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Jury has the better answer : jans = 5, pans = 4
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Ok
2 Correct 0 ms 204 KB Ok
3 Correct 1 ms 332 KB Ok
4 Correct 0 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 292 KB Ok
10 Correct 1 ms 204 KB Ok
11 Correct 1 ms 204 KB Ok
12 Correct 0 ms 204 KB Ok
13 Correct 0 ms 312 KB Ok
14 Correct 0 ms 204 KB Ok
15 Incorrect 0 ms 204 KB there is incorrect sequence
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Ok
2 Correct 0 ms 204 KB Ok
3 Correct 1 ms 332 KB Ok
4 Correct 0 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 292 KB Ok
10 Correct 1 ms 204 KB Ok
11 Correct 1 ms 204 KB Ok
12 Correct 0 ms 204 KB Ok
13 Incorrect 1 ms 312 KB there is incorrect sequence
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Ok
2 Correct 0 ms 204 KB Ok
3 Correct 1 ms 332 KB Ok
4 Correct 0 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 292 KB Ok
10 Correct 1 ms 204 KB Ok
11 Correct 1 ms 204 KB Ok
12 Correct 0 ms 204 KB Ok
13 Incorrect 1 ms 312 KB there is incorrect sequence
14 Halted 0 ms 0 KB -