結果

問題 No.1625 三角形の質問
ユーザー chineristACchineristAC
提出日時 2021-05-07 01:04:33
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,380 bytes
コンパイル時間 8,345 ms
コンパイル使用メモリ 283,136 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-09-25 20:39:25
合計ジャッジ時間 13,366 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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