結果

問題 No.5007 Steiner Space Travel
ユーザー ronnyaronnya
提出日時 2022-07-30 14:56:32
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 2,879 bytes
コンパイル時間 2,048 ms
実行使用メモリ 3,604 KB
スコア 2,635,980
最終ジャッジ日時 2022-07-30 14:56:37
合計ジャッジ時間 3,737 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
純コード判定しない問題か言語
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
3,524 KB
testcase_01 AC 1 ms
3,408 KB
testcase_02 AC 1 ms
3,412 KB
testcase_03 AC 1 ms
3,412 KB
testcase_04 AC 1 ms
3,408 KB
testcase_05 AC 1 ms
3,512 KB
testcase_06 AC 1 ms
3,548 KB
testcase_07 AC 2 ms
3,592 KB
testcase_08 AC 2 ms
3,572 KB
testcase_09 AC 1 ms
3,568 KB
testcase_10 AC 2 ms
3,524 KB
testcase_11 AC 2 ms
3,524 KB
testcase_12 AC 1 ms
3,604 KB
testcase_13 AC 2 ms
3,520 KB
testcase_14 AC 2 ms
3,532 KB
testcase_15 AC 1 ms
3,516 KB
testcase_16 AC 1 ms
3,532 KB
testcase_17 AC 1 ms
3,476 KB
testcase_18 AC 1 ms
3,512 KB
testcase_19 AC 1 ms
3,476 KB
testcase_20 AC 1 ms
3,592 KB
testcase_21 AC 2 ms
3,536 KB
testcase_22 AC 2 ms
3,476 KB
testcase_23 AC 1 ms
3,492 KB
testcase_24 AC 1 ms
3,476 KB
testcase_25 AC 2 ms
3,564 KB
testcase_26 AC 2 ms
3,520 KB
testcase_27 AC 2 ms
3,512 KB
testcase_28 AC 2 ms
3,592 KB
testcase_29 AC 1 ms
3,412 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;

using ll   = long long;     using ld   = long double;
using pll  = pair<ll, ll>;  using pld  = pair<ld, ld>;
using vll  = vector<ll>;    using vld  = vector<ld>;
using vpll = vector<pll>;   using vpld = vector<pld>;
using vvll = vector<vll>;   using vvld = vector<vld>;
template<class T> using min_queue = priority_queue<T, vector<T>, greater<T>>;
template<class T> using max_queue = priority_queue<T, vector<T>, less<T>>;

#define rep(i, a, b) for(ll i = (ll)a; i < (ll)b; i++)
#define irep(i, v) for(auto i = (v).begin(); i != (v).end(); i++)
#define SZ(v) (ll)(v).size()
#define ALL(v) (v).begin(), (v).end()
#define SHIFT(a) (1LL << (ll)a)
#define endl '\n'

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-10;
const ld PI  = M_PI;

ll power(ll x, ll y){ ll res = 1; while(y > 0){ if(y & 1){ res *= x; } x *= x; y >>= 1; } return res; }
bool in_grid(ll x, ll y, ll h, ll w){ return (0 <= x && x < h && 0 <= y && y < w); }
template<class T> void pvec(vector<T> &vec){ for(ll i = 0; i < (ll)vec.size(); i++){ if(i){ cout << " "; } cout << vec[i]; } cout << endl; }
template<class T> void pvvec(vector<vector<T>> &vec){ for(ll i = 0; i < (ll)vec.size(); i++){ for(ll j = 0; j < (ll)vec[i].size(); j++){ if(j){ cout << " "; } cout << vec[i][j]; } cout << endl; } }
template<class T> void asort(vector<T> &vec){ sort(ALL(vec)); }
template<class T> void rsort(vector<T> &vec){ sort(ALL(vec)); reverse(ALL(vec)); }

void pr(pll p){
  cout << p.first << " " << p.second << endl;
}

using ppll = pair<pll, ll>;

bool comp1(ppll &p1, ppll &p2){
  return (p1.first.first < p2.first.first);
}

bool comp2(ppll &p1, ppll &p2){
  return (p1.first.first > p2.first.first);
}


//using mint = modint<MOD>;

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  cout << fixed << setprecision(20);

  ll n, m;
  cin >> n >> m;
  vpll vec(n);
  rep(i, 0, n) cin >> vec[i].first >> vec[i].second;

  vector<ppll> vec1, vec2, vec3, vec4;

  ll x = vec[0].first, y = vec[0].second;
  rep(i, 1, n){
    ll xp = vec[i].first, yp = vec[i].second;
    if(xp >= x && yp < y) vec1.push_back({vec[i], i + 1});
    if(xp > x && yp >= y) vec2.push_back({vec[i], i + 1});
    if(xp <= x && yp > y) vec3.push_back({vec[i], i + 1});
    if(xp < x && yp <= y) vec4.push_back({vec[i], i + 1});
  }
  
  sort(ALL(vec1), comp1); 
  sort(ALL(vec2), comp2);
  sort(ALL(vec3), comp2);
  sort(ALL(vec4), comp1);

  rep(i, 0, m){
    pll t = {0, 0};
    pr(t);
  }

  ll v = n + 1;
  cout << v << endl;

  pr({1, 1});

  rep(i, 0, SZ(vec1)) cout << 1 << " " << vec1[i].second << endl;
  rep(i, 0, SZ(vec2)) cout << 1 << " " << vec2[i].second << endl;
  rep(i, 0, SZ(vec3)) cout << 1 << " " << vec3[i].second << endl;
  rep(i, 0, SZ(vec4)) cout << 1 << " " << vec4[i].second << endl;

  pr({1, 1});



  return 0;
}
0