結果
問題 | No.630 門松グラフ |
ユーザー | lumc_ |
提出日時 | 2018-01-08 16:33:58 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 145 ms / 1,500 ms |
コード長 | 3,627 bytes |
コンパイル時間 | 1,073 ms |
コンパイル使用メモリ | 101,156 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-06 01:40:17 |
合計ジャッジ時間 | 4,066 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 1 ms
5,376 KB |
testcase_03 | AC | 1 ms
5,376 KB |
testcase_04 | AC | 1 ms
5,376 KB |
testcase_05 | AC | 2 ms
5,376 KB |
testcase_06 | AC | 1 ms
5,376 KB |
testcase_07 | AC | 2 ms
5,376 KB |
testcase_08 | AC | 2 ms
5,376 KB |
testcase_09 | AC | 2 ms
5,376 KB |
testcase_10 | AC | 2 ms
5,376 KB |
testcase_11 | AC | 2 ms
5,376 KB |
testcase_12 | AC | 2 ms
5,376 KB |
testcase_13 | AC | 1 ms
5,376 KB |
testcase_14 | AC | 2 ms
5,376 KB |
testcase_15 | AC | 1 ms
5,376 KB |
testcase_16 | AC | 1 ms
5,376 KB |
testcase_17 | AC | 2 ms
5,376 KB |
testcase_18 | AC | 2 ms
5,376 KB |
testcase_19 | AC | 1 ms
5,376 KB |
testcase_20 | AC | 2 ms
5,376 KB |
testcase_21 | AC | 2 ms
5,376 KB |
testcase_22 | AC | 2 ms
5,376 KB |
testcase_23 | AC | 2 ms
5,376 KB |
testcase_24 | AC | 135 ms
5,376 KB |
testcase_25 | AC | 1 ms
5,376 KB |
testcase_26 | AC | 145 ms
5,376 KB |
testcase_27 | AC | 140 ms
5,376 KB |
testcase_28 | AC | 1 ms
5,376 KB |
testcase_29 | AC | 129 ms
5,376 KB |
testcase_30 | AC | 140 ms
5,376 KB |
testcase_31 | AC | 126 ms
5,376 KB |
testcase_32 | AC | 70 ms
5,376 KB |
testcase_33 | AC | 69 ms
5,376 KB |
testcase_34 | AC | 105 ms
5,376 KB |
testcase_35 | AC | 77 ms
5,376 KB |
ソースコード
// see https://github.com/LumaKernel/vimfiles/tree/master/snippets/cp-cpp/temp.snip const bool DEBUG = 1; /// --- .lumrc Template {{{ /// #include <iostream> #include <vector> #include <array> #include <map> #include <set> #include <queue> #include <deque> #include <stack> #include <tuple> #include <algorithm> #include <cmath> #include <cstring> #include <complex> #include <random> #include <iomanip> #include <cassert> #include <functional> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; using P = tuple<ll, ll>; using P3 = tuple<ll, ll, ll>; using VI = vector<int>; using VL = vector<ll>; using VP = vector<P>; using VS = vector<string>; #define omajinai ios::sync_with_stdio(false);cin.tie(0) #define FOR(i,a,b) for(int i=int(a);i<int(b);++i) #define FORI(i,a,b) for(int i=int(a);i<=int(b);++i) #define REP(i,n) FOR(i,0,n) #define REPI(i,n) FORI(i,0,n) #define RFOR(i,a,b) for(int i=int(b)-1;i>=int(a);--i) #define RFORI(i,a,b) for(int i=int(b);i>=int(a);--i) #define RREP(i,n) RFOR(i,0,n) #define RREPI(i,n) RFORI(i,0,n) #define ALL(a) (a).begin(),(a).end() #define UNIQUE(a) (a).erase(unique(ALL(a)),(a).end()) #define PB push_back #define EACH(i,c) REP(i,(c).size()) #define REACH(i,c) RREP(i,(c).size()) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort(ALL(c)) #define BR cout<<"\n"; #define dump(x) if(DEBUG) cerr<<"["<<__LINE__<< "] "<<#x<<"="<<(x)<<"\n"; #define dump2(x,y) if(DEBUG) cerr<<"["<<__LINE__<< "] "<<#x<<"="<<(x)\ <<" , "<<#y<<"="<<(y)<<"\n"; #define dump3(x,y,z) if(DEBUG)cerr<<"["<<__LINE__<<"] "<<#x<<"="<<(x)\ <<" , "<<#y<<"="<<(y)\ <<" , "<<#z<<"="<<(z)<<"\n"; #define SAY(x) if(DEBUG) cerr<<"["<<__LINE__<< "] "<<(x)<<"\n"; #define YES(x) cout<<((x)?"YES":"NO")<<"\n"; #define Yes(x) cout<<((x)?"Yes":"No")<<"\n"; #define yes(x) cout<<((x)?"yes":"no")<<"\n"; inline int omajinai_int_in(){omajinai;int n;cin>>n;return n;} inline ll omajinai_ll_in(){omajinai;ll n;cin>>n;return n;} inline string omajinai_string_in(){omajinai;string n;cin>>n;return n;} inline int int_in(){int n;cin>>n;return n;} inline ll ll_in(){ll n;cin>>n;return n;} inline string string_in(){string n;cin>>n;return n;} #define oini omajinai_int_in() #define oinl omajinai_ll_in() #define oins omajinai_string_in() #define ini int_in() #define inl ll_in() #define ins string_in() #define isInside(y,x) (0<=(y)&&(y)<h&&0<=(x)&&(x)<w) #define fi(x) (get<0>(x)) #define se(x) (get<1>(x)) #define th(x) (get<2>(x)) #define fo(x) (get<3>(x)) #define fif(x) (get<4>(x)) template <typename T> ostream &operator<<(ostream &o, const vector<T> &v) { o << '['; EACH(i, v) o << v[i] << (i != v.size()-1 ? ", " : ""); o << "]"; return o; } template <typename T> inline void smax(T &a, T b) { a = a > b ? a : b; } template <typename T> inline void smin(T &a, T b) { a = a < b ? a : b; } /// }}}--- /// constexpr int INF = 1e9+1; constexpr ll LINF = 1e18+1; constexpr int MOD = 1e9+7; ll ans; int main() { int n=ini,m=ini; int nn = n/2; // n-1 <= m <= n/2 * (n+1)/2 // n-1 <= m <= nn * (n-nn) if(n-1 > m || m > nn * (n-nn)) { cout << "NO" << endl; return 0; } VP es; es.reserve(m); int p = m - (n-1); REP(i, nn) { es.PB(P(i, i+nn)); if(i+nn+1<n) es.PB(P(i, i+nn+1)); int j = nn; while(p) { if(j >= n) break; if(j == i+nn || j == i+nn+1) { j++; continue; } es.PB(P(i, j)); j++; p--; } } cout << "YES" << endl; REP(i, n-1) cout << i+1 << " "; cout << n << endl; for(auto el:es) { cout << fi(el)+1 << " " << se(el)+1 << endl; } } //