提出 #4670942
ソースコード 拡げる
#include <bits/stdc++.h>
using namespace std;
#define _MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) _MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define pb push_back
#define all(x) begin(x),end(x)
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cerr<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cerr<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.first<<","<<p.second<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
#else
#define dbg(...) {}
#endif
int main(){
int n;
cin>>n;
using P = pair<int,int>;
vector<P> ans;
int bad;
if(n%2==1){
bad = n;
}
else {
bad = n+1;
}
rep(i,n) rep(j,i+1,n) if(i+j+2 != bad) ans.push_back({i+1, j+1});
cout << ans.size() << endl;
for(auto p : ans) cout << p.first << " " << p.second << "\n";
return 0;
}
提出情報
| 提出日時 |
|
| 問題 |
B - Balanced Neighbors |
| ユーザ |
tossy |
| 言語 |
C++14 (GCC 5.4.1) |
| 得点 |
700 |
| コード長 |
1232 Byte |
| 結果 |
AC |
| 実行時間 |
2 ms |
| メモリ |
384 KiB |
ジャッジ結果
| セット名 |
Sample |
All |
| 得点 / 配点 |
0 / 0 |
700 / 700 |
| 結果 |
|
|
| セット名 |
テストケース |
| Sample |
sample_01.txt |
| All |
sample_01.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt |
| ケース名 |
結果 |
実行時間 |
メモリ |
| sample_01.txt |
AC |
1 ms |
256 KiB |
| test_01.txt |
AC |
1 ms |
256 KiB |
| test_02.txt |
AC |
1 ms |
256 KiB |
| test_03.txt |
AC |
1 ms |
256 KiB |
| test_04.txt |
AC |
1 ms |
256 KiB |
| test_05.txt |
AC |
2 ms |
384 KiB |
| test_06.txt |
AC |
2 ms |
384 KiB |
| test_07.txt |
AC |
2 ms |
384 KiB |
| test_08.txt |
AC |
2 ms |
384 KiB |
| test_09.txt |
AC |
1 ms |
256 KiB |
| test_10.txt |
AC |
1 ms |
256 KiB |
| test_11.txt |
AC |
1 ms |
256 KiB |
| test_12.txt |
AC |
1 ms |
256 KiB |