Submission #7257724


Source Code Expand

Copy
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// gp_hash_table<int, int> mapka;

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

const int MAX = 111;
int n;
int x[MAX],y[MAX];
int il_wek(int a,int b){
  return x[a] * y[b] - x[b] * y[a];
}
int res = 0;
int kw(int a){
  return a * a;
}
int prob(int rx,int ry){
  maxi(res, kw(rx) + kw(ry));
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(20);
  cerr << fixed << setprecision(6);
  cin >> n;
  R(i,n) cin >> x[i] >> y[i];
  R(i,n){
    int lx=0,ly=0;
    int rx=0,ry=0;
    int sx=0,sy=0;
    R(j,n){
      int pom = il_wek(i,j);
      if(pom < 0){
        lx += x[j];
        ly += y[j];
      }else if(pom > 0){
        rx += x[j];
        ry += y[j];
      }else{
        sx += x[j];
        sy += y[j];
      }
      prob(lx,ly);
      prob(lx + sx,ly + sy);
      
      prob(rx,ry);
      prob(rx + sx,ry + sy);
    }
  }
  cout << sqrt(res) << "\n";
}

Submission Info

Submission Time
Task F - Engines
User Marcin
Language C++14 (GCC 5.4.1)
Score 0
Code Size 2287 Byte
Status WA
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 600
Status
AC × 7
AC × 37
WA × 4
Set Name Test Cases
Sample 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt, 00-sample-04.txt, 00-sample-05.txt, 00-sample-06.txt, 00-sample-07.txt
All 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt, 00-sample-04.txt, 00-sample-05.txt, 00-sample-06.txt, 00-sample-07.txt, 01-random-very-small-01.txt, 01-random-very-small-02.txt, 01-random-very-small-03.txt, 02-random-small-01.txt, 02-random-small-02.txt, 02-random-small-03.txt, 03-random-01.txt, 03-random-02.txt, 03-random-03.txt, 04-zero-01.txt, 05-same-01.txt, 05-same-02.txt, 06-linear-01.txt, 06-linear-02.txt, 06-linear-03.txt, 07-linear-positive-01.txt, 07-linear-positive-02.txt, 07-linear-positive-03.txt, 08-90-degree-01.txt, 08-90-degree-02.txt, 09-180-degree-01.txt, 09-180-degree-02.txt, 10-sandglass-01.txt, 10-sandglass-02.txt, 11-circle-01.txt, 11-circle-02.txt, 11-circle-03.txt, 11-circle-04.txt, 11-circle-05.txt, 12-square-01.txt, 12-square-02.txt, 12-square-03.txt, 13-corner-01.txt, 13-corner-02.txt
Case Name Status Exec Time Memory
00-sample-01.txt AC 1 ms 256 KB
00-sample-02.txt AC 1 ms 256 KB
00-sample-03.txt AC 1 ms 256 KB
00-sample-04.txt AC 1 ms 256 KB
00-sample-05.txt AC 1 ms 256 KB
00-sample-06.txt AC 1 ms 256 KB
00-sample-07.txt AC 1 ms 256 KB
01-random-very-small-01.txt AC 1 ms 256 KB
01-random-very-small-02.txt WA 1 ms 256 KB
01-random-very-small-03.txt WA 1 ms 256 KB
02-random-small-01.txt AC 1 ms 256 KB
02-random-small-02.txt AC 1 ms 256 KB
02-random-small-03.txt AC 1 ms 256 KB
03-random-01.txt AC 1 ms 256 KB
03-random-02.txt AC 1 ms 256 KB
03-random-03.txt AC 1 ms 256 KB
04-zero-01.txt AC 1 ms 256 KB
05-same-01.txt AC 1 ms 256 KB
05-same-02.txt AC 1 ms 256 KB
06-linear-01.txt AC 1 ms 256 KB
06-linear-02.txt WA 1 ms 256 KB
06-linear-03.txt WA 1 ms 256 KB
07-linear-positive-01.txt AC 1 ms 256 KB
07-linear-positive-02.txt AC 1 ms 256 KB
07-linear-positive-03.txt AC 1 ms 256 KB
08-90-degree-01.txt AC 1 ms 256 KB
08-90-degree-02.txt AC 1 ms 256 KB
09-180-degree-01.txt AC 1 ms 256 KB
09-180-degree-02.txt AC 1 ms 256 KB
10-sandglass-01.txt AC 1 ms 256 KB
10-sandglass-02.txt AC 1 ms 256 KB
11-circle-01.txt AC 1 ms 256 KB
11-circle-02.txt AC 1 ms 256 KB
11-circle-03.txt AC 1 ms 256 KB
11-circle-04.txt AC 1 ms 256 KB
11-circle-05.txt AC 1 ms 256 KB
12-square-01.txt AC 1 ms 256 KB
12-square-02.txt AC 1 ms 256 KB
12-square-03.txt AC 1 ms 256 KB
13-corner-01.txt AC 1 ms 256 KB
13-corner-02.txt AC 1 ms 256 KB