Submission #4664031
Source Code Expand
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define MAX_V 400010
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
#define INF 1e9+7
#define LLINF 1e18+7
ll MOD=1e9+7;
#define N 1100
vec x(1010,-1),y(1010,-1),z(1010,-1);
vector<pii> p;
struct bonus{
int a,b,c,d;
};
vector<bonus> bns(100010);
vector<vector<bonus>> bon(1010,vector<bonus>(1010));
main(){
int l=in(),n=in(),m=in();
rep(i,n)p.pb(pii{in(),in()});
rep(i,m){
bns[i]={in()-1,in()-1,in(),in()};
bon[bns[i].a].pb(bns[i]);
bon[bns[i].b].pb(bonus{bns[i].b,bns[i].a,bns[i].c,bns[i].d});
}
clock_t clo=clock();
cout<<clo<<endl<<endl;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
while(1){
int temp=rnd()%n;
int tempx=rnd()%(l-p[temp].first*2)+p[temp].first;
int tempy=rnd()%(l-p[temp].first*2)+p[temp].first;
vector<ll> mem(1001,0);
int tempr=p[temp].first;
rep(i,n){
if(x[i]==-1)continue;
int r=p[i].first+p[temp].first;
r=r*r;
int dis=(x[i]-tempx)*(x[i]-tempx)+(y[i]-tempy)*(y[i]-tempy);
int dd;
dd=(dis>r?0:sqrt(r-dis));
mem[max(0,z[i]-dd)]-=INF;
mem[min(l,z[i]+dd)+1]+=INF;
}
for(auto e:bon[temp]){
int viewing=e.b;
if(x[viewing]==-1)continue;
int dis=(x[e.b]-tempx)*(x[e.b]-tempx)+(y[e.b]-tempy)*(y[e.b]-tempy);
int dd=(dis>e.c*e.c?0:sqrt(e.c*e.c-dis));
mem[max(0,z[e.b]-dd)]+=e.d;
mem[min(l,z[e.b]+dd)+1]-=e.d;
}
int maxz=-1,tempmax=0;
mem[0]-=INF;
mem[tempr]+=INF;
mem[l-tempr+1]-=INF;
mem[l+1]-=INF;
rep(i,n){
mem[i+1]+=mem[i];
if(tempmax<mem[i]){maxz=i;tempmax=mem[i];}
}
bool flag=false;
if(double(clock() - clo) / double(CLOCKS_PER_SEC)>2.8)flag=1;;
if(maxz==-1&&flag!=true)continue;
else{
x[temp]=tempx;
y[temp]=tempy;
z[temp]=maxz;
}
if(flag)break;
}
rep(i,n){
cout<<x[i]<<" "<<y[i]<<" "<<z[i]<<endl;
}
}
Submission Info
Submission Time
2019-03-23 15:18:17+0900
Task
A - Multiple Pieces
User
noimi
Language
C++14 (GCC 5.4.1)
Score
0
Code Size
3349 Byte
Status
RE
Exec Time
107 ms
Memory
17792 KB
Compile Error
./Main.cpp: In function ‘int in()’:
./Main.cpp:44:31: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
int in() {int x;scanf("%d",&x);return x;}
^
./Main.cpp: In function ‘long long int lin()’:
./Main.cpp:45:32: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
ll lin() {ll x;scanf("%lld",&x);return x;}
^
Judge Result
Set Name
test_01
test_02
test_03
test_04
test_05
test_06
test_07
test_08
test_09
test_10
Score / Max Score
0 / 1343058
0 / 1343058
0 / 1343058
0 / 1343058
0 / 1343058
0 / 1343058
0 / 1343058
0 / 1343058
0 / 1343058
0 / 1343058
Status
Set Name
Test Cases
test_01
subtask_01_01.txt
test_02
subtask_01_02.txt
test_03
subtask_01_03.txt
test_04
subtask_01_04.txt
test_05
subtask_01_05.txt
test_06
subtask_01_06.txt
test_07
subtask_01_07.txt
test_08
subtask_01_08.txt
test_09
subtask_01_09.txt
test_10
subtask_01_10.txt
Case Name
Status
Exec Time
Memory
subtask_01_01.txt
RE
104 ms
17792 KB
subtask_01_02.txt
RE
104 ms
17792 KB
subtask_01_03.txt
RE
104 ms
17792 KB
subtask_01_04.txt
RE
105 ms
17792 KB
subtask_01_05.txt
RE
104 ms
17792 KB
subtask_01_06.txt
RE
103 ms
17792 KB
subtask_01_07.txt
RE
105 ms
17792 KB
subtask_01_08.txt
RE
104 ms
17792 KB
subtask_01_09.txt
RE
107 ms
17792 KB
subtask_01_10.txt
RE
106 ms
17792 KB