QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#659270#9487. Vivid Colorsucup-team1004#WA 15ms5680kbC++202.8kb2024-10-19 19:26:452024-10-19 19:26:46

Judging History

你现在查看的是最新测评结果

  • [2024-10-19 19:26:46]
  • 评测
  • 测评结果:WA
  • 用时:15ms
  • 内存:5680kb
  • [2024-10-19 19:26:45]
  • 提交

answer

#include<bits/stdc++.h>
#define Gc() getchar()
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define eb emplace_back
#define all(x) x.begin(),x.end()
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;
const int N=2e3+5,M=N*120+5,K=1000+5,mod=998244353,Mod=mod-1;const db eps=1e-10;const int INF=1e9+7;mt19937 rnd(263082);
#define Tp template<typename T>
#define Ts template<typename T,typename... Ar>
namespace Debug{
	Tp void _debug(char* f,T t){cerr<<f<<'='<<t<<endl;}
	Ts void _debug(char* f,T x,Ar... y){while(*f!=',') cerr<<*f++;cerr<<'='<<x<<",";_debug(f+1,y...);}
	#ifdef LOCAL
	#define gdb(...) _debug((char*)#__VA_ARGS__,__VA_ARGS__)
	#else 
	#define gdb(...) void()
	#endif
}using namespace Debug;
using cp=complex<db>;
int n,m,k;
int X[N],Y[N];
cp A[N];
db deg[N];
int rk[N],p[N];
ll sumx[N],sumy[N];
ll ans[N];
ll sq(ll x){return x*x;}
void chkmax(int x){
	ans[x]=max(ans[x],sq(2*sumx[x]-sumy[x])+sq(2*sumy[x]-sumx[x])+sq(sumx[x]+sumy[x]));
}
void chkswap(int x,db ti){
	ti+=1e-9;
	if(cos(ti)*(A[p[x]].real()-A[p[x+1]].real())+sin(ti)*(A[p[x]].imag()-A[p[x+1]].imag())<eps){
		swap(p[x],p[x+1]);
		swap(rk[p[x]],rk[p[x+1]]);
		sumx[x]=sumx[x-1]+X[p[x]];
		sumy[x]=sumy[x-1]+Y[p[x]];
		chkmax(x);
		ti-=1e-9;
		// if(x^1) chkswap(x-1,ti);
		// if(x^n-1) chkswap(x+1,ti);
	}
}
ll mpow(ll x,int y=mod-2){ll ans=1;while(y) y&1&&(ans=ans*x%mod),y>>=1,x=x*x%mod;return ans;}
void Solve(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		int x,y,z;scanf("%d%d%d",&x,&y,&z);
		X[i]=y-x;Y[i]=z-x;
		A[i]=cp(sqrt(6)*X[i]-5.0/sqrt(6)*Y[i],sqrt(6-25.0/6.0)*Y[i]);
	}
	for(int i=1;i<=n;i++){
		deg[i]=atan2(A[i].imag(),A[i].real());
	}
	const db pi=acos(-1);
	vector<tuple<db,int,int> > Q;
	for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) if(fabs(deg[i]-deg[j])>eps){
		db w=atan2(A[j].real()-A[i].real(),A[i].imag()-A[j].imag());
		if(w<0) w+=2*pi;
		Q.emplace_back(w,i,j);
	}
	sort(all(Q));
	iota(p+1,p+n+1,1);
	sort(p+1,p+n+1,[](int x,int y){return A[x].real()>A[y].real();});
	for(int i=1;i<=n;i++) rk[p[i]]=i;
	for(int i=1;i<=n;i++) sumx[i]=sumx[i-1]+X[p[i]],sumy[i]=sumy[i-1]+Y[p[i]],chkmax(i);
	for(auto [w,x,y]:Q){
		if(rk[x]^n) chkswap(rk[x],w);
		if(rk[x]^1) chkswap(rk[x]-1,w);
		if(rk[y]^n) chkswap(rk[y],w);
		if(rk[y]^1) chkswap(rk[y]-1,w);
		// for(int i=1;i<n;i++) chkswap(i,w);
	}
	for(int i=1;i<=n;i++) gdb(ans[i]);
	for(int i=1;i<=n;i++) printf("%lld\n",ans[i]%mod*mpow(27*i*i)%mod);
}
int main(){
	int t=1;
	// scanf("%d",&t);
	while(t--) Solve();
	cerr<<clock()*1.0/CLOCKS_PER_SEC<<'\n';
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 4364kb

input:

3
180 0 0
0 180 180
0 0 180

output:

7200
5400
800

result:

ok 3 tokens

Test #2:

score: 0
Accepted
time: 1ms
memory: 4496kb

input:

6
30594 32322 46262
63608 59020 98436
90150 32740 67209
82886 4627 54813
3112 67989 74995
60872 9967 9051

output:

715162883
838096208
930330061
405079896
880764907
526006962

result:

ok 6 tokens

Test #3:

score: 0
Accepted
time: 2ms
memory: 4748kb

input:

144
41472 41434 41317
16965 16900 17440
65702 65688 65497
15829 15900 15359
186620 186555 186425
22130 22030 22145
22995 23022 23320
54430 54525 54770
145816 145739 146046
106008 106083 106073
84481 84531 84306
162468 162563 162313
144375 144342 144210
68596 68548 68201
124014 124100 123649
137878 1...

output:

665561664
166436731
579289313
55518246
226327601
523827415
697242492
166428961
72628719
361639205
499632513
554631323
305233223
309029649
197725655
853581515
286740033
873681088
443094922
905119354
107690174
499165266
848371940
176043988
31275150
39747201
676490856
965461580
788056873
59932649
12538...

result:

ok 144 tokens

Test #4:

score: 0
Accepted
time: 12ms
memory: 5528kb

input:

282
94428 97009 94455
188420 188507 188612
93867 96593 93723
39525 41816 39549
192460 192576 192433
3845 1235 4121
11984 12390 12173
130725 130116 130896
87196 88124 87364
44538 45060 44298
166342 166632 166330
82059 84785 81813
27313 29691 27187
34038 35140 33798
54607 52867 54514
133483 131946 133...

output:

889314432
390117563
692023566
98907387
121626305
562561437
943457514
32985591
579638100
443215860
190588508
100335990
245223619
297117655
983188143
829225394
24317883
294014511
13323940
161909823
702330540
380190451
641303019
179896717
251619007
656550638
566922194
280229585
194457893
858751625
3209...

result:

ok 282 tokens

Test #5:

score: 0
Accepted
time: 11ms
memory: 5680kb

input:

271
153127 153535 152737
23323 22899 22765
34658 35090 35102
105004 105460 105508
137353 137025 137455
123997 123645 123883
11813 12333 11387
144072 144184 144198
190834 190866 191008
134203 134619 133837
160912 160400 161494
120883 121563 120775
183341 182637 183593
111598 112254 111034
34566 35078...

output:

322344
554885983
764388094
286496
120066627
542525190
428080325
887579586
216597238
807704248
412727458
450051205
289652425
201676353
851555207
107659595
407794390
845083057
11262308
601363802
380228455
744523302
119075663
10973283
784763125
915078500
635553912
194849886
439358978
606025095
61708067...

result:

ok 271 tokens

Test #6:

score: 0
Accepted
time: 8ms
memory: 4756kb

input:

300
104842 113680 113680
143955 136043 136043
29866 29080 29080
109288 101080 101080
172820 180722 180722
125104 118195 118195
24448 26967 26967
77313 70147 70147
24553 20285 20285
53114 43843 43843
42094 36323 36323
128136 118936 118936
71217 79147 79147
121620 123061 123061
100792 97508 97508
6721...

output:

909461736
22044800
21938688
909191994
381166451
767341949
684892751
794542288
656904216
460707595
108474983
919416671
87517565
286000639
180810310
793966736
508746481
257745719
464727415
117705770
19553070
874340280
950689183
651506248
866529385
679037134
681710885
712583626
879201340
547702999
5130...

result:

ok 300 tokens

Test #7:

score: -100
Wrong Answer
time: 15ms
memory: 5576kb

input:

300
182375 34340 31299
189896 7463 82920
175804 33229 17728
172428 38589 3152
179561 2042 66285
185751 10962 68975
194517 7716 93141
179439 7380 59163
199426 4435 108550
173662 1057 54086
194638 70081 13462
178554 31065 26778
170726 851 47650
182300 49007 12324
185665 62746 2389
188363 25586 56187
1...

output:

723410220
723410220
723410220
768126446
338316563
569722059
884298494
450839164
500000726
501438353
968813043
884187518
913040181
104496160
511869647
412649735
554576076
926037850
70590348
228830915
450591176
818756596
407973139
376830029
456126980
222769635
269583751
138028931
380406929
504792028
5...

result:

wrong answer 5th words differ - expected: '968000807', found: '338316563'