ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#201115 | #3483. deque | Josephcheng | 100 | 46ms | 2644kb | C++11 | 360b | 2024-01-21 09:23:41 | 2024-01-21 12:03:45 |
answer
#include<bits/stdc++.h>
using namespace std;
int n;
int a[200005];
deque<int> q;
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++)
scanf("%d",&a[i]);
q.push_front(a[1]);
for(int i=2;i<=n;i++){
if(a[i]<=q.front()) q.push_front(a[i]);
else q.push_back(a[i]);
}
while(q.size()){
printf("%d ",q.front());
q.pop_front();
}
}
Details
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1232kb
input:
12 5 6 15 9 7 11 13 17 3 4 8 1 16 14 18 2 10
output:
1 3 5 6 15 9 7 11 13 17 4 8
result:
ok single line: '1 3 5 6 15 9 7 11 13 17 4 8 '
Test #2:
score: 10
Accepted
time: 0ms
memory: 1232kb
input:
13 4 2 5 18 12 17 9 15 8 11 10 14 7 3 19 16 1 6
output:
2 4 5 18 12 17 9 15 8 11 10 14 7
result:
ok single line: '2 4 5 18 12 17 9 15 8 11 10 14 7 '
Test #3:
score: 10
Accepted
time: 0ms
memory: 1236kb
input:
9 13 20 7 12 6 3 5 11 1 16 18 4 17 8 15 2 10 19 14
output:
1 3 6 7 13 20 12 5 11
result:
ok single line: '1 3 6 7 13 20 12 5 11 '
Test #4:
score: 10
Accepted
time: 0ms
memory: 1236kb
input:
296 1001 1481 242 1288 558 1768 1030 411 1654 1174 560 1586 774 80 1917 1944 1979 1325 641 1834 1364...
output:
8 11 30 62 80 242 1001 1481 1288 558 1768 1030 411 1654 1174 560 1586 774 1917 1944 1979 1325 641 18...
result:
ok single line: '8 11 30 62 80 242 1001 1481 12...106 1644 312 809 1575 646 1052 '
Test #5:
score: 10
Accepted
time: 0ms
memory: 1256kb
input:
1856 1501 1453 363 450 1915 854 1597 1348 1916 1412 669 574 90 1974 1021 390 1284 1820 1388 1715 110...
output:
1 3 4 6 9 14 52 90 363 1453 1501 450 1915 854 1597 1348 1916 1412 669 574 1974 1021 390 1284 1820 13...
result:
ok single line: '1 3 4 6 9 14 52 90 363 1453 15... 923 250 1945 1646 380 602 365 '
Test #6:
score: 10
Accepted
time: 0ms
memory: 1256kb
input:
965 1911 248 1658 1241 991 1792 596 1123 1829 1709 1328 1358 445 1637 934 1400 1346 1571 995 1599 85...
output:
4 5 17 81 131 248 1911 1658 1241 991 1792 596 1123 1829 1709 1328 1358 445 1637 934 1400 1346 1571 9...
result:
ok single line: '4 5 17 81 131 248 1911 1658 12...98 1621 400 1887 20 46 328 110 '
Test #7:
score: 10
Accepted
time: 0ms
memory: 1236kb
input:
253 1920 266 609 217 1653 64 1477 664 1915 1010 368 905 1337 1516 675 842 729 1141 202 555 1487 1468...
output:
8 52 64 217 266 1920 609 1653 1477 664 1915 1010 368 905 1337 1516 675 842 729 1141 202 555 1487 146...
result:
ok single line: '8 52 64 217 266 1920 609 1653 ...993 197 716 273 1369 1569 1055 '
Test #8:
score: 10
Accepted
time: 0ms
memory: 1232kb
input:
565 995 1768 950 1008 1825 1042 590 1482 1877 1253 805 750 369 629 1068 1916 230 1609 171 771 1537 1...
output:
6 15 18 19 125 171 230 369 590 950 995 1768 1008 1825 1042 1482 1877 1253 805 750 629 1068 1916 1609...
result:
ok single line: '6 15 18 19 125 171 230 369 590... 233 1581 75 786 640 1094 1431 '
Test #9:
score: 10
Accepted
time: 16ms
memory: 2376kb
input:
144742 177209 172172 84814 193683 199225 153842 187959 198438 153656 173678 198099 150049 153033 187...
output:
1 3 6 7 9 22 53 78 111 513 708 1479 62171 84814 172172 177209 193683 199225 153842 187959 198438 153...
result:
ok single line: '1 3 6 7 9 22 53 78 111 513 708...007 100052 138169 99526 125689 '
Test #10:
score: 10
Accepted
time: 30ms
memory: 2644kb
input:
184358 197379 186373 185190 178020 191800 193913 142834 196312 193864 184884 134703 187031 151062 12...
output:
1 6 7 19 53 56 81 311 585 14869 18003 19260 63790 74142 79363 125499 134703 142834 178020 185190 186...
result:
ok single line: '1 6 7 19 53 56 81 311 585 1486...06 122936 128655 118259 179510 '