Submission #1735585


Source Code Expand

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "YES"; }
  string_type do_falsename() const { return "NO"; }
};

using Point = complex<ld>;

const ld eps = 1e-10;

bool comp(Point a, Point b) {
  return real(a - b) * 1.347589 + imag(a - b) > 0;
}

ld dot(Point a, Point b) { return real(conj(a) * b); }
ld cross(Point a, Point b) { return imag(conj(a) * b); }

struct Line {
  Point a, b;
  Line (Point p, Point q) : a(p), b(q) {;}
};

Point is_ll(Line s, Line t) {
  Point sv = s.b - s.a, tv = t.b - t.a;
  return s.a + sv * cross(tv, t.a - s.a) / cross(tv, sv);
}

void solve(ll N, vector<ll> x, vector<ll> y) {
  const Point p1 = Point(3.293485, 9.49480194);
  const Point p2 = Point(4.47101083, 9.1273874);
  const Line line(p1, p2);
  vector<Point> p(N);
  REP(i,N) p[i] = Point(x[i], y[i]);
  vector<pair<ld,int>> vec1;
  vector<ld> vec2;
  REP(i,N) REP(j,i) {
    Line l(p[i], p[j]);
    Point point = is_ll(l, line);
    const ld d = abs(point - p1);
    vec1.emplace_back(d, i);
    vec1.emplace_back(d, j);
    vec2.push_back(d);
  }
  sort(ALL(vec2));
  vector<ld> vec3;
  for (ld x: vec2) {
    if (vec3.empty() || abs(vec3.back() - x) > eps)
      vec3.push_back(x);
  }
  const int m = vec3.size();
  vector<set<int>> sets(m);
  for (auto p: vec1) {
    auto it = lower_bound(ALL(vec3), p.first - eps);
    sets[it - begin(vec3)].insert(p.second);
  }
  vector<int> two(256);
  const int mod = 998244353;
  two[0] = 1;
  REP(i,255) two[i+1] = two[i] * 2 % mod;
  int res = two[N];
  for (auto &s: sets) {
    res = (res - (two[s.size()] - 1 - s.size()) + mod) % mod;
  }
  res -= N + 1;
  cout << res << endl;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
  ll N;
 	scanf("%lld", &N);
	vector<ll> x(N-1+1);
	vector<ll> y(N-1+1);
	for (int i = 0 ; i <= N-1 ; i++) {
	  scanf("%lld", &x[i]);
	  scanf("%lld", &y[i]);
	}
	solve(N, x, y);
	return 0;
}

Submission Info

Submission Time
Task E - ConvexScore
User asi1024
Language C++14 (GCC 5.4.1)
Score 700
Code Size 3180 Byte
Status AC
Exec Time 17 ms
Memory 4916 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:121:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld", &N);
                    ^
./Main.cpp:125:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
    scanf("%lld", &x[i]);
                        ^
./Main.cpp:126:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
    scanf("%lld", &y[i]);
                        ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 700 / 700
Status
AC × 3
AC × 36
Set Name Test Cases
Sample 0_000.txt, 0_001.txt, 0_002.txt
All 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt, 1_021.txt, 1_022.txt, 1_023.txt, 1_024.txt, 1_025.txt, 1_026.txt, 1_027.txt, 1_028.txt, 1_029.txt, 1_030.txt, 1_031.txt, 1_032.txt, 1_033.txt, 1_034.txt, 1_035.txt
Case Name Status Exec Time Memory
0_000.txt AC 3 ms 384 KB
0_001.txt AC 1 ms 256 KB
0_002.txt AC 1 ms 256 KB
1_003.txt AC 1 ms 256 KB
1_004.txt AC 1 ms 256 KB
1_005.txt AC 7 ms 2108 KB
1_006.txt AC 1 ms 256 KB
1_007.txt AC 10 ms 2360 KB
1_008.txt AC 7 ms 1848 KB
1_009.txt AC 9 ms 2232 KB
1_010.txt AC 4 ms 960 KB
1_011.txt AC 9 ms 2616 KB
1_012.txt AC 11 ms 3000 KB
1_013.txt AC 7 ms 1976 KB
1_014.txt AC 2 ms 256 KB
1_015.txt AC 5 ms 1596 KB
1_016.txt AC 3 ms 960 KB
1_017.txt AC 17 ms 4916 KB
1_018.txt AC 17 ms 4916 KB
1_019.txt AC 16 ms 3508 KB
1_020.txt AC 15 ms 3508 KB
1_021.txt AC 15 ms 3764 KB
1_022.txt AC 16 ms 4148 KB
1_023.txt AC 16 ms 4532 KB
1_024.txt AC 16 ms 4532 KB
1_025.txt AC 15 ms 4276 KB
1_026.txt AC 15 ms 4276 KB
1_027.txt AC 8 ms 2872 KB
1_028.txt AC 8 ms 2872 KB
1_029.txt AC 15 ms 4276 KB
1_030.txt AC 16 ms 4788 KB
1_031.txt AC 17 ms 4788 KB
1_032.txt AC 16 ms 4788 KB
1_033.txt AC 17 ms 4788 KB
1_034.txt AC 17 ms 4916 KB
1_035.txt AC 14 ms 3636 KB