結果

問題 No.1625 三角形の質問
コンテスト
ユーザー chineristAC
提出日時 2021-05-07 01:04:33
言語 C++17(gcc12)
(gcc 12.4.0 + boost 1.90.0)
コンパイル:
g++-12 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 2,380 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 7,338 ms
コンパイル使用メモリ 318,880 KB
実行使用メモリ 69,380 KB
最終ジャッジ日時 2026-06-20 05:22:04
合計ジャッジ時間 15,231 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <random>
#include <stdio.h>
#include <fstream>
#include <functional>
#include <atcoder/all>
#include "testlib.h"
using namespace std;
using namespace atcoder;

#define rep(i,n,c) for (int i=0;i<n;i+=c)
#define append push_back
#define all(x) (x).begin(), (x).end()

template<class T>
using vec = vector<T>;
template<class T>
using vvec = vec<vec<T>>;
template<class T>
using vvvec = vec<vvec<T>>;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;


template<class T>
bool chmin(T &a, T b){
  if (a>b){
    a = b;
    return true;
  }
  return false;
}

template<class T>
bool chmax(T &a, T b){
  if (a<b){
    a = b;
    return true;
  }
  return false;
}

template<class T>
T sum(vec<T> x){
  T res=0;
  for (auto e:x){
    res += e;
  }
  return res;
}

template<class T>
void printv(vec<T> x){
  for (auto e:x){
    cout<<e<<" ";
  }
  cout<<"\n";
}


const ll INF = 1e17;

const int MIN_N = 1;
const int MAX_N = 100000;
const int MIN_Q = 1;
const int MAX_Q = 100000;
const ll MIN_x = 1;
const ll MAX_x = 1000000000;

ll area(ll a,ll b,ll c,ll d,ll e,ll f){
  ll S = (c-a)*(f-b)-(d-b)*(e-a);
  return abs(S);
}

int main(int argc, char* argv[]){
  registerValidation(argc,argv);
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);

  int N = inf.readInt(MIN_N,MAX_N,"N");
  inf.readSpace();
  int Q = inf.readInt(MIN_Q,MAX_Q,"Q");
  inf.readEoln();

  vector<ll> A(6);
  for (int i=0;i<N;i++){
    for (int j=0;j<6;j++){
      A[j] = inf.readLong(MIN_x,MAX_x);
      if (j!=5){
        inf.readSpace();
      }
      else{
        inf.readEoln();
      }
    }
    if (area(A[0],A[1],A[2],A[3],A[4],A[5])==0){
      return -1;
    }
  }

  int t;
  ll l,r;
  for (int i=0;i<Q;i++){
    t = inf.readInt(1,2);
    inf.readSpace();
    if (t==1){
      for (int j=0;j<6;j++){
        A[j] = inf.readLong(MIN_x,MAX_x);
        if (j!=5){
          inf.readSpace();
        }
        else{
          inf.readEoln();
        }
      }
      if (area(A[0],A[1],A[2],A[3],A[4],A[5])==0){
        return -1;
      }
    }
    else{
      l = inf.readLong(MIN_x,MAX_x);
      inf.readSpace();
      r = inf.readLong(MIN_x,MAX_x);
      inf.readEoln();
    }
  }
  inf.readEof();



  

  
}
0