답안 #335266

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
335266 2020-12-11T18:30:41 Z limabeans Nice sequence (IZhO18_sequence) C++17
0 / 100
1 ms 492 KB
#include <bits/stdc++.h>
using namespace std;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;


const int N = 1e6;


void solve(ll n, ll m) {
    assert(min(n,m)==2);

    if (n==2) {
	if (m%2==0) {
	    cout<<"0\n";
	    return;
	}
	cout<<m<<"\n";
	vector<ll> w(m,N);
	for (int i=1; i<m; i+=2) {
	    w[i]=-N-1;
	}
	cout<<m<<"\n";
	for (ll x: w) cout<<x<<" ";
	cout<<"\n";

	assert(accumulate(w.begin(),w.end(),0ll)>0);
	return;
    }

    if (m==2) {
	if (n%2==0) {
	    cout<<"0\n";
	    return;
	}
	cout<<n<<"\n";
	vector<ll> w(n,N);
	for (int i=0; i<n; i+=2) {
	    w[i]=-N+1;
	}
	for (ll x: w) cout<<x<<" ";
	cout<<"\n";

	assert(accumulate(w.begin(),w.end(),0ll)<0);
	return;
    }
    
    assert(false);
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);


    int t;
    cin>>t;
    while (t--) {
	ll n,m;
	cin>>n>>m;
	solve(n,m);
    }
    
    
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Jury has the better answer : jans = 1, pans = 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -