| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1300297 | hihihihaw | Newspapers (CEOI21_newspapers) | C++20 | 1 ms | 688 KiB |
#pragma GCC optimize("O3,unroll-loops,fast-math")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define sz(v) (int)v.size()
#define fi first
#define se second
#define INF 1223372036854775807
#define INF2 122337203
#define MOD 998244353 s
#define cint(x) int x;cin>>x;
#define cinarr(a,n) int a[n];for (int i=0;i<n;i++) cin>>a[i];
#define coutarr(a) for (auto d:a)cout<<d<<" "; cout<<endl;
#define coutarrD(a) for (auto d:a) cout<<d.fi<<","<<d.se<<" "; cout<<endl;
#define BERKAY_TUP ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl '\n'
#define ld long double
#define mid (start+end)/2
#define vvi vector<vector<int>>
int t=1;
int interactive=0;
int usaco=0;
int testCase=0;
void solve(){
int n,m;
cin>>n>>m;
if (m!=n-1){
cout<<"NO"<<endl;
return;
}
if (n==1){
cout<<"YES"<<endl;
cout<<1<<endl;
cout<<1<<endl;
return;
}
if (n==2){
cout<<"YES"<<endl;
cout<<2<<endl;
cout<<"2 2"<<endl;
return;
}
cout<<"YES"<<endl;
cout<<2*n-4<<endl;
for (int i=2;i<=n-1;i++) cout<<i<<" ";
for (int i=n-1;i>=2;i--) cout<<i<<" ";
cout<<endl;
}
int32_t main(){
BERKAY_TUP;
if (usaco){
freopen("team.in", "r", stdin);
freopen("team.out", "w", stdout);
}
if (!interactive){
#ifdef Local
freopen("in.txt", "r", stdin);
freopen("out2.txt", "w", stdout);
//freopen("wormsort.out", "w", stdout);
#endif
}
if (t==1) solve();
else{
cin>>t;
while (t--){testCase++;solve();}
}
return 0;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
