QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#786984 | #9663. Reverse Pairs Coloring | rotcar07 | AC ✓ | 20ms | 7280kb | C++23 | 6.5kb | 2024-11-27 07:03:46 | 2024-11-27 07:03:47 |
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));}
constexpr int maxn=3e5+5;
int n,t[maxn],a[maxn],pos[maxn];
inline void add(int x,int y){while(x<=n)t[x]+=y,x+=x&-x;}
inline int query(int x){int res=0;while(x)res+=t[x],x-=x&-x;return res;}
int main(){
cin>>n;
for(int i=1;i<=n;i++)cin>>a[i],pos[a[i]]=i;
long long ans=0;a[n+1]=n+1;
for(int i=n;i>=1;i--){
add(max(a[i],a[i+1]),-1);
if(pos[a[i]-1]+1<pos[a[i]]) ans-=query(a[i]);
add(a[i],1);
if(pos[a[i]]+1<pos[a[i]+1]) ans+=query(min(n,a[i]+1))-1;
}
add(a[1],-1);ans+=query(1);
cout<<ans<<'\n';
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3716kb
input:
9 5 9 1 8 2 6 4 7 3
output:
5
result:
ok single line: '5'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
2 1 2
output:
0
result:
ok single line: '0'
Test #3:
score: 0
Accepted
time: 0ms
memory: 5552kb
input:
2 2 1
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
12 12 11 10 9 8 7 6 5 4 3 2 1
output:
1
result:
ok single line: '1'
Test #5:
score: 0
Accepted
time: 0ms
memory: 5732kb
input:
12 2 5 3 7 1 12 11 9 8 4 10 6
output:
8
result:
ok single line: '8'
Test #6:
score: 0
Accepted
time: 0ms
memory: 5756kb
input:
12 1 2 3 4 5 6 7 8 9 10 11 12
output:
0
result:
ok single line: '0'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
144 144 143 142 141 140 139 138 137 136 135 134 133 132 131 130 129 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61...
output:
1
result:
ok single line: '1'
Test #8:
score: 0
Accepted
time: 1ms
memory: 5748kb
input:
144 78 106 141 21 115 2 14 64 124 91 117 121 30 99 144 55 94 137 38 27 40 72 59 46 50 109 84 15 87 108 52 23 74 4 140 70 63 58 105 113 77 10 35 66 130 34 96 86 16 65 12 92 83 5 95 36 45 8 79 132 75 57 98 93 119 125 26 18 136 127 73 90 3 123 53 139 142 37 103 24 133 111 143 67 76 43 114 42 44 135 22 ...
output:
699
result:
ok single line: '699'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3512kb
input:
144 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...
output:
0
result:
ok single line: '0'
Test #10:
score: 0
Accepted
time: 1ms
memory: 5688kb
input:
1728 1728 1727 1726 1725 1724 1723 1722 1721 1720 1719 1718 1717 1716 1715 1714 1713 1712 1711 1710 1709 1708 1707 1706 1705 1704 1703 1702 1701 1700 1699 1698 1697 1696 1695 1694 1693 1692 1691 1690 1689 1688 1687 1686 1685 1684 1683 1682 1681 1680 1679 1678 1677 1676 1675 1674 1673 1672 1671 1670 ...
output:
1
result:
ok single line: '1'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
1728 802 233 421 541 844 722 70 119 697 499 1699 1323 1537 1053 551 1125 736 686 1378 630 1070 192 1650 652 291 1182 1405 848 684 1557 100 1704 329 504 611 795 1242 1548 680 1355 1693 66 479 1194 607 316 913 1343 276 701 78 737 279 804 1438 30 754 1115 745 1017 767 1046 920 683 988 1494 501 669 1658...
output:
83738
result:
ok single line: '83738'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
1728 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...
output:
0
result:
ok single line: '0'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3936kb
input:
20736 20736 20735 20734 20733 20732 20731 20730 20729 20728 20727 20726 20725 20724 20723 20722 20721 20720 20719 20718 20717 20716 20715 20714 20713 20712 20711 20710 20709 20708 20707 20706 20705 20704 20703 20702 20701 20700 20699 20698 20697 20696 20695 20694 20693 20692 20691 20690 20689 20688 ...
output:
1
result:
ok single line: '1'
Test #14:
score: 0
Accepted
time: 2ms
memory: 5832kb
input:
20736 15428 2928 14988 4279 13247 8077 8128 5263 19240 2440 3234 3008 9868 13229 657 14625 7333 17930 9043 1743 3440 7846 5030 10290 14958 1451 9866 13357 3826 15385 7304 4033 12973 16937 131 5361 2814 6706 2681 5908 9738 15648 4911 18164 12531 10392 5428 6612 15193 9154 11479 8291 1187 1136 6330 10...
output:
11906581
result:
ok single line: '11906581'
Test #15:
score: 0
Accepted
time: 1ms
memory: 5840kb
input:
20736 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...
output:
0
result:
ok single line: '0'
Test #16:
score: 0
Accepted
time: 3ms
memory: 6808kb
input:
248832 248832 248831 248830 248829 248828 248827 248826 248825 248824 248823 248822 248821 248820 248819 248818 248817 248816 248815 248814 248813 248812 248811 248810 248809 248808 248807 248806 248805 248804 248803 248802 248801 248800 248799 248798 248797 248796 248795 248794 248793 248792 248791...
output:
1
result:
ok single line: '1'
Test #17:
score: 0
Accepted
time: 16ms
memory: 6784kb
input:
248832 124869 135755 12850 214130 145599 75073 35346 33333 87655 46111 222853 201944 54979 230688 13628 144356 233045 217207 157626 123582 209484 242708 191577 173182 117845 10771 93744 56439 163427 46992 103372 174039 150400 177984 244446 58937 188383 31124 16092 128575 38724 34774 204536 75835 218...
output:
1722641914
result:
ok single line: '1722641914'
Test #18:
score: 0
Accepted
time: 7ms
memory: 6996kb
input:
248832 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
0
result:
ok single line: '0'
Test #19:
score: 0
Accepted
time: 9ms
memory: 7248kb
input:
300000 300000 299999 299998 299997 299996 299995 299994 299993 299992 299991 299990 299989 299988 299987 299986 299985 299984 299983 299982 299981 299980 299979 299978 299977 299976 299975 299974 299973 299972 299971 299970 299969 299968 299967 299966 299965 299964 299963 299962 299961 299960 299959...
output:
1
result:
ok single line: '1'
Test #20:
score: 0
Accepted
time: 20ms
memory: 7256kb
input:
300000 239415 50154 20266 131115 94234 36028 102103 163828 247232 288414 191935 70446 292328 101071 278663 149866 15685 291862 236268 78373 298325 130058 200948 182893 276807 219715 33136 269040 46221 48212 250438 121345 179565 46706 177889 240176 94461 152264 78126 50364 161649 258824 265439 203657...
output:
2502054663
result:
ok single line: '2502054663'
Test #21:
score: 0
Accepted
time: 9ms
memory: 7280kb
input:
300000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
0
result:
ok single line: '0'
Test #22:
score: 0
Accepted
time: 4ms
memory: 7280kb
input:
300000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
110520823
result:
ok single line: '110520823'
Test #23:
score: 0
Accepted
time: 11ms
memory: 7124kb
input:
299999 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
17730774
result:
ok single line: '17730774'
Test #24:
score: 0
Accepted
time: 10ms
memory: 7208kb
input:
299998 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
20981055
result:
ok single line: '20981055'
Test #25:
score: 0
Accepted
time: 11ms
memory: 7244kb
input:
300000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
150603720
result:
ok single line: '150603720'
Test #26:
score: 0
Accepted
time: 15ms
memory: 7124kb
input:
299999 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
91305765
result:
ok single line: '91305765'
Test #27:
score: 0
Accepted
time: 13ms
memory: 7200kb
input:
299998 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
60403678
result:
ok single line: '60403678'
Test #28:
score: 0
Accepted
time: 10ms
memory: 7252kb
input:
300000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
4278147
result:
ok single line: '4278147'
Test #29:
score: 0
Accepted
time: 10ms
memory: 7160kb
input:
299999 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
4741668
result:
ok single line: '4741668'
Test #30:
score: 0
Accepted
time: 9ms
memory: 7132kb
input:
299998 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
4366163
result:
ok single line: '4366163'
Test #31:
score: 0
Accepted
time: 14ms
memory: 7124kb
input:
300000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 48 23 47 42 40 45 30 44 37 35 33 43 22 29 31 39 41 26 25 34 38 24 46 32 27 36 28 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 82 99 87 80 77 85 94 97 91 95 98 89 86 84 96 78 88 81 79 101 83 93 100 90 ...
output:
264124
result:
ok single line: '264124'
Test #32:
score: 0
Accepted
time: 10ms
memory: 7116kb
input:
299999 1 8 13 24 12 6 17 9 16 10 21 14 19 20 25 23 11 7 2 22 18 3 15 5 4 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
274653
result:
ok single line: '274653'
Test #33:
score: 0
Accepted
time: 15ms
memory: 7120kb
input:
299998 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 41 32 34 37 33 38 31 35 39 42 36 40 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 72 67 66 74 65 68 81 94 87 100 64 73 70 88 63 71 59 76 61 83 75 106 92 90 77 60 103 62 97 85 82 98 69 99 86 93 84 80 101 89 104 ...
output:
276918
result:
ok single line: '276918'
Test #34:
score: 0
Accepted
time: 14ms
memory: 7120kb
input:
300000 1 5 3 4 2 6 8 7 9 10 11 13 12 14 18 17 16 15 19 21 20 23 22 26 25 24 27 28 29 30 31 32 33 36 34 35 38 41 39 37 42 40 43 44 45 46 49 47 48 50 51 52 54 53 55 56 58 61 57 59 60 62 63 64 65 68 66 67 71 69 70 72 73 74 76 75 77 78 80 79 81 82 85 84 83 87 90 89 86 88 92 91 95 93 94 96 98 97 101 100 ...
output:
64559
result:
ok single line: '64559'
Test #35:
score: 0
Accepted
time: 14ms
memory: 7128kb
input:
299999 1 2 5 3 4 6 8 7 10 9 11 12 14 13 15 16 17 18 19 20 21 22 23 27 28 25 26 24 29 30 31 33 32 35 34 36 37 38 39 40 42 41 43 44 46 45 47 49 48 50 51 52 53 54 55 57 56 58 59 60 62 61 63 64 65 66 67 70 69 68 72 71 74 73 75 76 77 80 78 79 84 82 85 83 81 86 87 88 89 91 90 92 93 94 95 96 97 98 99 101 1...
output:
64793
result:
ok single line: '64793'
Test #36:
score: 0
Accepted
time: 9ms
memory: 7232kb
input:
299998 1 3 2 4 5 7 6 8 9 16 10 11 15 12 13 14 17 18 20 19 21 24 23 22 25 26 27 28 29 31 30 32 33 34 35 36 37 38 40 39 41 42 43 45 44 46 48 47 49 50 51 52 53 55 54 56 57 59 58 61 60 62 65 63 64 66 67 68 71 70 69 72 73 74 76 75 77 78 79 81 80 82 83 84 85 86 92 89 87 93 94 90 91 88 95 97 99 98 96 100 1...
output:
64978
result:
ok single line: '64978'
Test #37:
score: 0
Accepted
time: 7ms
memory: 7204kb
input:
300000 2 1 3 4 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 23 24 26 25 28 27 29 30 32 31 34 33 35 36 38 37 40 39 42 41 44 43 45 46 48 47 50 49 51 52 53 54 55 56 58 57 59 60 62 61 63 64 65 66 67 68 69 70 71 72 74 73 76 75 78 77 79 80 81 82 84 83 86 85 87 88 90 89 92 91 93 94 96 95 97 98 99 100 1...
output:
75227
result:
ok single line: '75227'
Test #38:
score: 0
Accepted
time: 11ms
memory: 7188kb
input:
299999 2 1 4 3 6 5 7 8 10 9 12 11 13 14 15 16 17 18 19 20 22 21 23 24 25 26 28 27 29 30 31 32 34 33 35 36 37 38 40 39 42 41 43 44 46 45 47 48 49 50 52 51 53 54 56 55 58 57 60 59 62 61 64 63 66 65 68 67 69 70 72 71 73 74 76 75 78 77 80 79 81 82 84 83 86 85 88 87 90 89 91 92 93 94 95 96 97 98 99 100 1...
output:
75181
result:
ok single line: '75181'
Test #39:
score: 0
Accepted
time: 11ms
memory: 7252kb
input:
299998 2 1 3 4 6 5 8 7 10 9 12 11 13 14 16 15 18 17 20 19 22 21 24 23 25 26 27 28 29 30 31 32 33 34 36 35 38 37 40 39 42 41 43 44 46 45 48 47 49 50 52 51 54 53 56 55 58 57 59 60 62 61 64 63 66 65 67 68 69 70 71 72 73 74 76 75 78 77 79 80 81 82 84 83 86 85 88 87 89 90 92 91 94 93 96 95 98 97 100 99 1...
output:
75078
result:
ok single line: '75078'
Test #40:
score: 0
Accepted
time: 7ms
memory: 7064kb
input:
300000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
110381728
result:
ok single line: '110381728'
Test #41:
score: 0
Accepted
time: 15ms
memory: 7196kb
input:
300000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
181841683
result:
ok single line: '181841683'
Test #42:
score: 0
Accepted
time: 7ms
memory: 7260kb
input:
300000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 92...
output:
2097809
result:
ok single line: '2097809'
Test #43:
score: 0
Accepted
time: 12ms
memory: 7248kb
input:
300000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
152347
result:
ok single line: '152347'
Test #44:
score: 0
Accepted
time: 14ms
memory: 7128kb
input:
300000 1 2 3 4 5 6 9 8 7 10 11 12 14 13 18 17 16 15 19 21 20 25 24 23 22 27 26 28 29 34 33 32 31 30 35 36 37 40 39 38 41 44 43 42 45 46 48 47 51 50 49 53 52 55 54 56 57 58 59 60 61 63 62 68 67 66 65 64 71 70 69 72 73 74 77 76 75 78 79 80 81 82 83 84 86 85 87 90 89 88 91 93 92 94 95 96 97 99 98 100 1...
output:
74153
result:
ok single line: '74153'
Test #45:
score: 0
Accepted
time: 7ms
memory: 7196kb
input:
300000 300000 150000 299999 149998 299998 149996 299997 149994 299996 149992 299995 149990 299994 149988 299993 149986 299992 149984 299991 149982 299990 149980 299989 149978 299988 149976 299987 149974 299986 149972 299985 149970 299984 149968 299983 149966 299982 149964 299981 149962 299980 149960...
output:
2812612499
result:
ok single line: '2812612499'
Test #46:
score: 0
Accepted
time: 7ms
memory: 7252kb
input:
299999 299999 150000 299998 149998 299997 149996 299996 149994 299995 149992 299994 149990 299993 149988 299992 149986 299991 149984 299990 149982 299989 149980 299988 149978 299987 149976 299986 149974 299985 149972 299984 149970 299983 149968 299982 149966 299981 149964 299980 149962 299979 149960...
output:
2812612498
result:
ok single line: '2812612498'
Extra Test:
score: 0
Extra Test Passed