QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#735088 | #9283. Socks Drying | N_z_ | AC ✓ | 1ms | 4124kb | C++23 | 6.8kb | 2024-11-11 17:14:06 | 2024-11-11 17:14:06 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
struct time_helper{
#ifdef LOCAL
clock_t time_last;time_helper(){time_last=clock();}void test(){auto time_now=clock();std::cerr<<"time:"<<1.*(time_now-time_last)/CLOCKS_PER_SEC<<";all_time:"<<1.*time_now/CLOCKS_PER_SEC<<std::endl;time_last=time_now;}~time_helper(){test();}
#else
void test(){}
#endif
}time_helper;
#ifdef LOCAL
#include"dbg.h"
#else
#define dbg(...) (__VA_ARGS__)
#endif
namespace Fread{const int SIZE=1<<16;char buf[SIZE],*S,*T;inline char getchar(){if(S==T){T=(S=buf)+fread(buf,1,SIZE,stdin);if(S==T)return'\n';}return *S++;}}namespace Fwrite{const int SIZE=1<<16;char buf[SIZE],*S=buf,*T=buf+SIZE;inline void flush(){fwrite(buf,1,S-buf,stdout);S=buf;}inline void putchar(char c){*S++=c;if(S==T)flush();}struct NTR{~NTR(){flush();}}ztr;}
#define getchar Fread::getchar
#define putchar Fwrite::putchar
int print_precision=10;bool print_T_endl=1;char print_between=' ';
template<typename T>struct is_char{static constexpr bool value=(std::is_same<T,char>::value||std::is_same<T,signed char>::value||std::is_same<T,unsigned char>::value);};template<typename T>struct is_integral_ex{static constexpr bool value=(std::is_integral<T>::value||std::is_same<T,__int128>::value)&&!is_char<T>::value;};template<typename T>struct is_floating_point_ex{static constexpr bool value=std::is_floating_point<T>::value||std::is_same<T,__float128>::value;};namespace Fastio{struct Reader;struct Writer;template<size_t id>struct read_tuple{template<typename...T>static void read(Reader&stream,std::tuple<T...>&x){read_tuple<id-1>::read(stream,x);stream>>get<id-1>(x);}};template<>struct read_tuple<0>{template<typename...T>static void read([[maybe_unused]]Reader&stream,[[maybe_unused]]std::tuple<T...>&x){}};template<size_t id>struct print_tuple{template<typename...T>static void print(Writer&stream,const std::tuple<T...>&x){print_tuple<id-1>::print(stream,x);putchar(print_between);stream<<get<id-1>(x);}};template<>struct print_tuple<1>{template<typename...T>static void print(Writer&stream,const std::tuple<T...>&x){stream<<get<0>(x);}};template<>struct print_tuple<0>{template<typename...T>static void print([[maybe_unused]]Writer&stream,[[maybe_unused]]const std::tuple<T...>&x){}};
struct Reader{template<typename T>typename std::enable_if_t<std::is_class<T>::value,Reader&>operator>>(T&x){for(auto &y:x)*this>>y;return *this;}template<typename...T>Reader&operator>>(std::tuple<T...>&x){read_tuple<sizeof...(T)>::read(*this,x);return *this;}template<typename T>typename std::enable_if_t<is_integral_ex<T>::value,Reader&>operator>>(T&x){char c=getchar();short f=1;while(c<'0'||c>'9'){if(c=='-')f*=-1;c=getchar();}x=0;while(c>='0'&&c<='9'){x=(x<<1)+(x<<3)+(c^48);c=getchar();}x*=f;return *this;}template<typename T>typename std::enable_if_t<is_floating_point_ex<T>::value,Reader&>operator>>(T&x){char c=getchar();short f=1,s=0;x=0;T t=0;while((c<'0'||c>'9')&&c!='.'){if(c=='-')f*=-1;c=getchar();}while(c>='0'&&c<='9'&&c!='.')x=x*10+(c^48),c=getchar();if(c=='.')c=getchar();else return x*=f,*this;while(c>='0'&&c<='9')t=t*10+(c^48),s++,c=getchar();while(s--)t/=10.0;x=(x+t)*f;return*this;}template<typename T>typename std::enable_if_t<is_char<T>::value,Reader&>operator>>(T&c){c=getchar();while(c=='\n'||c==' '||c=='\r')c=getchar();return *this;}Reader&operator>>(char*str){int len=0;char c=getchar();while(c=='\n'||c==' '||c=='\r')c=getchar();while(c!='\n'&&c!=' '&&c!='\r')str[len++]=c,c=getchar();str[len]='\0';return*this;}template<typename T1,typename T2>Reader&operator>>(std::pair<T1,T2>&x){*this>>x.first>>x.second;return *this;}Reader&operator>>(std::string&str){str.clear();char c=getchar();while(c=='\n'||c==' '||c=='\r')c=getchar();while(c!='\n'&&c!=' '&&c!='\r')str.push_back(c),c=getchar();return*this;}Reader(){}}cin;const char endl='\n';
struct Writer{typedef __int128 mxdouble;template<typename T>typename std::enable_if_t<std::is_class<T>::value,Writer&>operator<<(const T&x){for(auto q:x){*this<<q;if(!is_class<decltype(q)>::value)*this<<print_between;}if(!is_class<typename T::value_type>::value&&print_T_endl)*this<<'\n';return *this;}template<typename...T>Writer&operator<<(const std::tuple<T...>&x){print_tuple<sizeof...(T)>::print(*this,x);if(print_T_endl)*this<<'\n';return *this;}template<typename T>typename std::enable_if_t<is_integral_ex<T>::value,Writer&>operator<<(T x){if(x==0)return putchar('0'),*this;if(x<0)putchar('-'),x=-x;static int sta[45];int top=0;while(x)sta[++top]=x%10,x/=10;while(top)putchar(sta[top]+'0'),--top;return*this;}template<typename T>typename std::enable_if_t<is_floating_point_ex<T>::value,Writer&>operator<<(T x){if(x<0)putchar('-'),x=-x;x+=pow(10,-print_precision)/2;mxdouble _=x;x-=(T)_;static int sta[45];int top=0;while(_)sta[++top]=_%10,_/=10;if(!top)putchar('0');while(top)putchar(sta[top]+'0'),--top;putchar('.');for(int i=0;i<print_precision;i++)x*=10;_=x;while(_)sta[++top]=_%10,_/=10;for(int i=0;i<print_precision-top;i++)putchar('0');while(top)putchar(sta[top]+'0'),--top;return*this;}template<typename T>typename std::enable_if_t<is_char<T>::value,Writer&>operator<<(const T&c){putchar(c);return*this;}Writer&operator<<(char*str){int cur=0;while(str[cur])putchar(str[cur++]);return *this;}Writer&operator<<(const char*str){int cur=0;while(str[cur])putchar(str[cur++]);return*this;}template<typename T1,typename T2>Writer&operator<<(const std::pair<T1,T2>&x){*this<<x.first<<print_between<<x.second;if(print_T_endl)*this<<'\n';return *this;}Writer&operator<<(const std::string&str){int st=0,ed=str.size();while(st<ed)putchar(str[st++]);return*this;}Writer(){}}cout;}
#define cin Fastio::cin
#define cout Fastio::cout
#define endl Fastio::endl
template<class Fun>class y_combinator_result{Fun fun_;public:template<class T>explicit y_combinator_result(T &&fun): fun_(std::forward<T>(fun)) {}template<class ...Args>decltype(auto) operator()(Args &&...args){return fun_(std::ref(*this), std::forward<Args>(args)...);}};template<class Fun>decltype(auto) y_combinator(Fun &&fun){return y_combinator_result<std::decay_t<Fun>>(std::forward<Fun>(fun));}
void init();void solve(int tc);
main()
{
init();int t=1;
// cin>>t;
for(int tc=1;tc<=t;tc++)solve(tc);
}
void init()
{
}
constexpr double d[5][5]=
{
{0.5000000000,0.6000000000,0.6428571429,0.6666666667,0.6818181818,},
{1.0000000000,1.2000000000,1.2857142857,1.3333333333,1.3636363636,},
{1.5000000000,1.8000000000,1.9285714286,2.0000000000,2.0454545455,},
{2.0000000000,2.4000000000,2.5714285714,2.6666666667,2.7272727273,},
{2.5000000000,3.0000000000,3.2142857143,3.3333333333,3.4090909091,},
};
void solve([[maybe_unused]]int tc)
{
int n;
cin>>n;
int cnt[5]={};
double ans=0;
for(int x=0;x<n;x++)
{
int v;
cin>>v;
ans+=3*v;
cnt[v-1]++;
}
for(int x=0;x<5;x++)
for(int y=0;y<x;y++)
ans+=(d[x][y]+d[y][x])*cnt[x]*cnt[y];
for(int x=0;x<5;x++)
ans+=d[x][x]*cnt[x]*(cnt[x]-1);
cout<<ans<<endl;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3860kb
input:
1 1
output:
3.0000000000
result:
ok found '3.0000000', expected '3.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3976kb
input:
1 3
output:
9.0000000000
result:
ok found '9.0000000', expected '9.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3988kb
input:
2 1 1
output:
7.0000000000
result:
ok found '7.0000000', expected '7.0000000', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 4028kb
input:
3 3 2 2
output:
29.5714285714
result:
ok found '29.5714286', expected '29.5714286', error '0.0000000'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
15 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5
output:
662.3402597409
result:
ok found '662.3402597', expected '662.3402597', error '0.0000000'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3992kb
input:
25 1 1 4 3 3 3 2 5 1 4 4 2 5 5 3 5 2 4 2 1 2 5 1 3 4
output:
1335.7316017330
result:
ok found '1335.7316017', expected '1335.7316017', error '0.0000000'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3988kb
input:
50 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5
output:
4989.9696969760
result:
ok found '4989.9696970', expected '4989.9696970', error '0.0000000'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3776kb
input:
500 4 3 3 3 4 5 1 4 4 4 1 3 4 2 3 3 1 2 2 2 1 5 5 2 2 2 4 2 5 3 2 3 3 5 3 1 1 1 1 2 5 1 5 1 2 1 1 3 4 5 3 4 1 1 4 1 3 2 1 4 4 5 1 1 5 3 4 2 4 3 5 2 2 4 3 5 2 5 4 5 5 2 2 1 2 4 2 1 5 3 1 5 1 4 2 2 2 5 1 3 2 2 5 4 2 4 2 5 4 3 1 3 3 4 3 1 3 1 5 3 5 2 2 2 1 4 2 3 4 3 3 1 5 4 2 4 1 5 3 5 3 3 4 4 5 1 5 2 ...
output:
467230.8658015600
result:
ok found '467230.8658016', expected '467230.8658009', error '0.0000000'
Test #9:
score: 0
Accepted
time: 1ms
memory: 3920kb
input:
200000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
20000500000.0000000000
result:
ok found '20000500000.0000000', expected '20000500000.0000000', error '0.0000000'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
10000 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ...
output:
341025000.0009090304
result:
ok found '341025000.0009090', expected '341025000.0000000', error '0.0000000'
Test #11:
score: 0
Accepted
time: 1ms
memory: 3976kb
input:
200000 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5...
output:
136365954545.8181915283
result:
ok found '136365954545.8181915', expected '136365954545.4545441', error '0.0000000'
Test #12:
score: 0
Accepted
time: 1ms
memory: 4036kb
input:
200000 4 4 4 4 4 4 4 4 5 4 5 5 4 5 5 4 4 5 4 4 4 5 4 5 4 5 5 5 5 4 4 5 4 4 5 4 5 5 4 4 5 4 5 5 4 5 5 5 5 4 4 5 5 5 4 4 5 5 5 5 5 4 5 4 5 4 4 5 4 4 5 5 4 5 4 4 4 5 4 4 4 5 5 5 4 4 5 5 4 4 5 4 4 5 4 5 5 5 5 4 5 4 4 5 4 5 5 5 4 5 5 5 4 5 4 5 4 4 4 5 5 4 4 5 4 4 4 5 4 5 4 4 4 4 5 4 4 4 5 4 4 4 4 5 5 5 5...
output:
121365728788.2424163818
result:
ok found '121365728788.2424164', expected '121365728787.8787842', error '0.0000000'
Test #13:
score: 0
Accepted
time: 1ms
memory: 4036kb
input:
150002 1 1 1 2 3 1 2 3 1 1 1 2 3 2 2 2 1 1 3 2 2 2 2 1 3 2 1 1 2 2 3 3 1 3 2 3 2 3 2 3 1 1 2 1 2 3 2 1 1 2 3 1 2 2 2 2 2 1 3 1 2 2 2 1 3 3 3 1 3 3 2 2 2 3 2 2 3 2 2 1 2 3 3 3 2 2 1 1 2 1 1 1 2 3 3 1 3 2 1 1 2 3 2 1 2 1 1 3 3 2 3 1 1 1 2 3 1 2 3 1 1 2 3 2 3 2 2 2 2 1 3 1 1 3 3 3 3 1 2 3 1 2 2 2 2 1 2...
output:
26144672886.6190414428
result:
ok found '26144672886.6190414', expected '26144672886.4761887', error '0.0000000'
Test #14:
score: 0
Accepted
time: 1ms
memory: 3860kb
input:
200000 5 5 5 5 5 5 5 5 5 5 3 4 5 4 4 5 5 5 4 3 5 4 4 3 3 5 5 5 5 5 5 5 3 5 5 4 3 4 3 4 3 5 3 5 4 3 5 4 3 4 5 3 5 3 3 4 4 3 5 3 5 5 5 5 5 5 5 3 5 5 5 4 3 3 5 3 5 3 5 3 5 5 5 3 5 5 5 4 3 4 5 5 3 4 5 4 3 4 5 5 4 5 5 3 4 4 5 5 3 3 5 4 5 3 4 3 5 4 5 5 3 4 5 4 3 4 5 3 5 5 4 3 3 5 5 3 4 5 5 5 4 5 5 4 4 4 4...
output:
113611286688.7543334960
result:
ok found '113611286688.7543335', expected '113611286688.3116913', error '0.0000000'
Test #15:
score: 0
Accepted
time: 1ms
memory: 4124kb
input:
200000 2 3 2 2 2 3 3 2 5 5 2 3 2 3 2 5 3 4 4 4 4 5 5 4 4 4 5 4 4 3 3 3 3 5 3 5 3 2 5 3 2 3 3 5 4 4 5 3 2 4 4 4 4 5 5 4 5 2 3 3 5 3 4 2 3 2 5 3 4 2 3 3 4 4 3 4 3 3 5 5 2 5 5 4 5 3 2 4 4 4 3 4 5 3 4 5 3 3 4 2 3 3 5 5 3 3 3 4 4 2 4 3 3 4 3 2 4 4 4 4 3 5 5 4 4 4 3 5 5 2 5 3 5 3 4 2 3 5 2 5 4 5 4 4 2 5 5...
output:
90698609480.5497894287
result:
ok found '90698609480.5497894', expected '90698609480.5194855', error '0.0000000'
Test #16:
score: 0
Accepted
time: 1ms
memory: 3928kb
input:
200000 1 2 5 1 1 3 5 3 2 3 3 2 2 2 4 5 3 1 3 3 1 3 5 2 2 3 4 2 5 3 4 5 2 5 2 3 2 4 1 5 3 5 3 4 4 1 3 1 2 3 4 3 3 4 2 5 5 4 5 1 2 5 3 4 3 3 2 2 2 1 2 5 5 3 3 5 5 5 2 2 3 1 5 4 4 5 5 2 4 5 2 5 4 3 2 1 5 5 3 5 1 4 1 2 5 4 1 5 2 2 1 2 3 5 4 4 1 4 2 3 2 1 4 1 4 5 1 5 4 1 5 4 4 4 4 4 4 5 3 2 5 3 2 4 4 5 1...
output:
74193619619.1598205566
result:
ok found '74193619619.1598206', expected '74193619619.0476227', error '0.0000000'
Test #17:
score: 0
Accepted
time: 1ms
memory: 3960kb
input:
200000 3 5 5 1 4 3 3 3 5 5 3 4 2 1 5 1 1 4 4 2 4 3 3 5 1 5 5 2 1 4 3 2 3 3 4 4 3 3 5 5 3 5 5 4 3 3 3 2 4 1 3 2 2 2 4 3 5 1 3 3 2 3 1 4 3 3 2 5 2 2 1 2 4 1 2 3 2 4 5 4 2 3 5 4 2 4 4 2 1 5 3 2 1 5 1 4 4 1 5 1 2 3 5 4 1 5 3 3 4 1 5 5 1 1 4 4 3 5 4 2 5 4 4 5 1 1 3 4 1 4 3 2 3 5 5 4 1 2 1 3 1 3 4 4 5 4 5...
output:
74191942588.1123046875
result:
ok found '74191942588.1123047', expected '74191942588.0000000', error '0.0000000'
Test #18:
score: 0
Accepted
time: 1ms
memory: 3924kb
input:
200000 1 3 2 4 4 5 3 3 5 3 5 1 3 2 2 4 5 5 4 5 5 1 4 3 1 3 5 4 2 1 2 3 2 4 3 3 5 4 5 5 1 2 4 2 5 3 2 2 5 4 4 5 5 4 4 3 3 5 1 5 1 3 4 5 5 4 4 3 3 4 1 5 5 5 2 3 4 2 2 5 5 4 3 3 5 5 5 4 5 4 3 5 5 5 4 3 4 1 4 4 5 5 4 4 5 5 4 3 3 5 4 5 3 2 4 3 5 3 4 5 5 1 4 3 4 3 2 1 1 5 5 2 4 5 2 5 4 4 3 3 1 5 4 5 4 1 5...
output:
89542084593.4157257080
result:
ok found '89542084593.4157257', expected '89542084593.2727203', error '0.0000000'
Test #19:
score: 0
Accepted
time: 1ms
memory: 3832kb
input:
199999 4 3 1 5 1 4 3 3 5 5 1 4 3 4 1 4 5 4 3 3 5 4 3 4 4 5 4 5 4 3 1 1 5 3 4 1 3 4 1 3 1 3 1 5 3 1 1 5 4 1 5 4 4 3 1 4 4 4 1 3 3 5 5 1 5 3 4 1 4 3 3 1 5 3 3 3 1 4 3 4 4 4 3 5 4 5 3 1 4 5 3 4 4 1 4 5 3 4 1 1 3 4 3 5 4 5 4 5 3 1 5 5 5 1 3 4 5 1 4 4 5 5 3 5 5 3 1 4 4 4 4 3 5 1 4 1 5 5 5 4 3 3 1 1 4 1 4...
output:
80967504849.8138580322
result:
ok found '80967504849.8138580', expected '80967504849.4285736', error '0.0000000'
Test #20:
score: 0
Accepted
time: 1ms
memory: 3796kb
input:
200000 5 1 1 5 1 5 5 5 1 1 5 5 5 1 5 5 5 5 1 1 5 5 5 5 1 1 5 5 1 5 5 1 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 1 5 5 5 1 1 5 5 5 5 5 5 1 5 5 5 1 1 1 5 5 1 5 5 5 5 5 5 5 1 5 5 5 5 5 5 5 5 5 1 5 5 5 5 1 5 5 5 1 5 5 5 5 5 1 5 5 1 5 1 1 5 1 5 5 1 5 5 1 5 1 5 5 1 1 5 5 5 1 5 5 5 5 1 1 5 5 1 5 5 5 5 5...
output:
101817807677.9028320312
result:
ok found '101817807677.9028320', expected '101817807677.8346252', error '0.0000000'
Test #21:
score: 0
Accepted
time: 1ms
memory: 4052kb
input:
199999 4 2 4 4 4 4 4 2 2 4 4 4 2 4 4 2 4 4 4 2 2 2 4 2 4 4 4 4 4 4 2 4 4 2 4 4 4 4 4 2 4 4 2 4 4 4 4 2 4 4 4 4 4 4 4 2 4 2 4 4 2 4 2 2 4 4 4 4 4 4 4 4 4 2 2 4 4 4 2 2 4 4 4 4 4 4 2 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 2 4 4 4 4 4 4 4 4 2 4 4 2 4 4 2 4 2 4 4 4 4 4 4 4 4 2 4 2 4 4 4 4 4 4 4 4 4 4 4 4 4 4 2 2...
output:
91000121202.5241851806
result:
ok found '91000121202.5241852', expected '91000121202.0242462', error '0.0000000'
Extra Test:
score: 0
Extra Test Passed