QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#659172 | #9487. Vivid Colors | ucup-team1004# | WA | 1146ms | 70800kb | C++20 | 2.7kb | 2024-10-19 19:02:14 | 2024-10-19 19:02:20 |
Judging History
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-9;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(sumx[x]-2*sumy[x])+sq(sumy[x]-2*sumx[x])+sq(sumx[x]+sumy[x]));
}
void chkswap(int x,db ti){
ti+=1e-7;
if(cos(ti)*A[p[x]].real()+sin(ti)*A[p[x]].imag()<cos(ti)*A[p[x+1]].real()+sin(ti)*A[p[x+1]].imag()){
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);
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]-3.0/4*sqrt(6)*Y[i],sqrt(6-27.0/8)*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[i].imag()-A[j].imag(),A[j].real()-A[i].real());
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++) 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: 4512kb
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: 0ms
memory: 4444kb
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: 6ms
memory: 4576kb
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: 21ms
memory: 5808kb
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: 21ms
memory: 5704kb
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: 11ms
memory: 4568kb
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: 0
Accepted
time: 22ms
memory: 5460kb
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 968000807 978289779 686716556 300986523 23685666 100863542 817903116 368292549 966551585 815525412 775319408 530137969 106128595 713413782 14090737 580333162 736583094 17911566 818088391 284054642 161362307 515282086 487513444 432115986 582112009 211599028 776...
result:
ok 300 tokens
Test #8:
score: 0
Accepted
time: 23ms
memory: 5816kb
input:
300 152843 194847 111534 143276 172558 89245 60327 105984 22671 128676 175881 92568 121633 166382 83069 105658 145368 62055 124729 163074 79761 106430 139071 55758 102353 144000 60687 106582 145138 61825 135534 170455 87142 132677 175622 92309 87838 124176 40863 127763 162661 79348 57824 87301 3988 ...
output:
199685421 254923155 408725470 573435441 993166600 778057960 402409983 198533293 620160445 757271783 45914347 559925318 333601004 636739495 779637954 910451416 197133729 719355632 138699036 711225505 662430730 816748658 118604432 106049642 217966163 21164675 626881354 798024734 61816036 866368325 961...
result:
ok 300 tokens
Test #9:
score: -100
Wrong Answer
time: 1146ms
memory: 70800kb
input:
2000 46852 76871 93555 109329 4592 117118 85100 78035 166719 9336 156179 29277 93649 191864 9597 139268 193640 103865 65176 45936 22032 140243 24791 33044 190522 37917 165916 129355 113010 72009 90540 120070 180615 161806 63989 192069 137247 149177 120171 10653 20063 85613 97726 10036 38469 159738 1...
output:
667500967 561870818 227733218 708027088 503022645 936956883 568087276 65695301 103966866 777260851 400197479 712392592 452503693 262345617 470045142 723034628 398361563 708274989 151258829 5630611 826259002 935693539 63404055 561026681 692615880 774294332 215173128 420114593 376847155 640103994 5242...
result:
wrong answer 317th words differ - expected: '602954626', found: '770901786'