Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "testlib.h"
- #include <algorithm>
- #include <cstdio>
- #include <iostream>
- using namespace std;
- const double MAXSCORE = 2970.0;
- const double eps = 1e-5;
- int n;
- double score(InStream& out,vector<double>& x,vector<double>& y){
- for (int i = 0; i < n; i++){
- x[i] = out.readDouble();
- y[i] = out.readDouble();
- double r = sqrt(x[i] * x[i] + y[i] * y[i]);
- if (r > 1 + eps)
- quitf(_pe, "Point outside circle, r=%.9f", r);
- if (r > 1){
- x[i] = x[i] / r;
- y[i] = y[i] / r;
- }
- }
- double minarea = 4;
- for (int i = 0; i < n; i++)
- for (int j = i+1; j < n; j++)
- for (int k = j+1; k < n; k++)
- {
- double area = fabs(x[i] * y[j] - x[j] * y[i] + x[j] * y[k] - x[k] * y[j] + x[k] * y[i] - x[i] * y[k]) / 2;
- minarea = min(minarea, area);
- }
- return minarea;
- }
- int main(int argc,char** argv){
- registerTestlibCmd(argc,argv);
- n = inf.readInt(1,365);
- vector<double> px(n),py(n),jx(n),jy(n);
- double ja = score(ans,jx,jy);
- double pa = score(ouf,px,py);
- if (ja < pa){
- ans.close();
- FILE* ansf = fopen(argv[3],"w");
- for (int i = 0; i < n; i++)
- fprintf(ansf,"%.10lf %.10lf",px[i],py[i]);
- fclose(ansf);
- printf("%d\n", (int)(MAXSCORE));
- return 0;
- }
- printf("%d\n", (int)max(0.0,pa/ja * MAXSCORE));
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement