QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#120197 | #6348. Egor Has a Problem | hos_lyric | AC ✓ | 66ms | 9208kb | C++14 | 2.2kb | 2023-07-06 14:54:59 | 2023-07-06 14:55:00 |
Judging History
answer
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using Int = long long;
template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
int N;
vector<Int> A;
void Answer(int i, int j, int k, int l) {
puts("YES");
printf("%d %d %d %d\n", i + 1, j + 1, k + 1, l + 1);
}
bool solve() {
vector<int> is;
for (int i = 0; i < N - 1; ++i) if (A[i + 1] / A[i] == 1) {
is.push_back(i);
}
sort(is.begin(), is.end());
const int isLen = is.size();
for (int e = 0; e < isLen; ++e) {
for (int f = e + 1; f <= e + 2 && f < isLen; ++f) {
if (is[f] - is[e] > 1) {
Answer(is[e], is[e] + 1, is[f], is[f] + 1);
return true;
}
}
}
for (int i = 0; i < N; ++i) for (int j = i + 1; j < N; ++j) {
for (int k = j + 1; k < N; ++k) for (int l = k + 1; l < N; ++l) {
if (A[j] / A[i] == A[l] / A[k]) {
Answer(i, j, k, l);
return true;
}
}
}
return false;
}
int main() {
for (; ~scanf("%d", &N); ) {
A.resize(N);
for (int i = 0; i < N; ++i) {
scanf("%lld", &A[i]);
}
const bool res = solve();
if (!res) {
puts("NO");
}
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3636kb
input:
6 2 6 11 21 47 120
output:
YES 1 3 4 6
result:
ok OK
Test #2:
score: 0
Accepted
time: 1ms
memory: 3456kb
input:
5 1 2 6 30 210
output:
NO
result:
ok OK
Test #3:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
4 7 13 77 143
output:
YES 1 2 3 4
result:
ok OK
Test #4:
score: 0
Accepted
time: 1ms
memory: 3504kb
input:
4 10 29 31 100
output:
NO
result:
ok OK
Test #5:
score: 0
Accepted
time: 47ms
memory: 9080kb
input:
500000 627045176858 4817409059014 6288122580263 11138485427254 14292718094002 14799874839768 16926890883539 17617152313162 17645472255619 18208915248631 22963632241827 24466999302606 25551903318615 26091633648017 38200644379849 39885775205129 40036378248650 40309675851194 40773414900416 408933438176...
output:
YES 2 3 4 5
result:
ok OK
Test #6:
score: 0
Accepted
time: 58ms
memory: 9060kb
input:
500000 4296317198460 9088530306835 12761569474357 16261038279090 16941085611205 18350614838717 22480413215272 23329628179141 24312311764761 24433929342173 27221427530427 28176763451413 28796907935821 30472998712185 32522454545697 33716639435084 36803789739537 36820525380957 39761789956892 4078696306...
output:
YES 2 3 4 5
result:
ok OK
Test #7:
score: 0
Accepted
time: 66ms
memory: 9060kb
input:
500000 2486629253945 2653364744556 4284488165789 4329370039939 4642065503681 6901749347495 19192137130640 21230142707219 21572527039148 22380596790669 24549580468932 24705234465366 24809017205084 25372640950744 30936948747149 31605133106641 35382503368540 36668459004194 39297585189262 40441705410326...
output:
YES 1 2 3 4
result:
ok OK
Test #8:
score: 0
Accepted
time: 56ms
memory: 9164kb
input:
500000 1212707463644 3060808785468 5253681005592 6636218910647 8688761397981 9169130038833 9604296507161 10581672897486 14606712594653 18215478522408 19985113657583 21876858531698 22009681507073 25744252327149 29854713235059 30049643326503 35465827651805 38437058489989 40205415453241 42389564776077 ...
output:
YES 2 3 4 5
result:
ok OK
Test #9:
score: 0
Accepted
time: 53ms
memory: 9080kb
input:
500000 1 999999999999500002 999999999999500003 999999999999500004 999999999999500005 999999999999500006 999999999999500007 999999999999500008 999999999999500009 999999999999500010 999999999999500011 999999999999500012 999999999999500013 999999999999500014 999999999999500015 999999999999500016 999999...
output:
YES 2 3 4 5
result:
ok OK
Test #10:
score: 0
Accepted
time: 58ms
memory: 9060kb
input:
500000 2 999999999999500002 999999999999500003 999999999999500004 999999999999500005 999999999999500006 999999999999500007 999999999999500008 999999999999500009 999999999999500010 999999999999500011 999999999999500012 999999999999500013 999999999999500014 999999999999500015 999999999999500016 999999...
output:
YES 2 3 4 5
result:
ok OK
Test #11:
score: 0
Accepted
time: 58ms
memory: 9200kb
input:
500000 3 999999999999500002 999999999999500003 999999999999500004 999999999999500005 999999999999500006 999999999999500007 999999999999500008 999999999999500009 999999999999500010 999999999999500011 999999999999500012 999999999999500013 999999999999500014 999999999999500015 999999999999500016 999999...
output:
YES 2 3 4 5
result:
ok OK
Test #12:
score: 0
Accepted
time: 64ms
memory: 9132kb
input:
500000 4 999999999999500002 999999999999500003 999999999999500004 999999999999500005 999999999999500006 999999999999500007 999999999999500008 999999999999500009 999999999999500010 999999999999500011 999999999999500012 999999999999500013 999999999999500014 999999999999500015 999999999999500016 999999...
output:
YES 2 3 4 5
result:
ok OK
Test #13:
score: 0
Accepted
time: 58ms
memory: 9208kb
input:
500000 1 399999999999500002 399999999999500003 399999999999500004 399999999999500005 399999999999500006 399999999999500007 399999999999500008 399999999999500009 399999999999500010 399999999999500011 399999999999500012 399999999999500013 399999999999500014 399999999999500015 399999999999500016 399999...
output:
YES 2 3 4 5
result:
ok OK
Test #14:
score: 0
Accepted
time: 60ms
memory: 9208kb
input:
500000 2 399999999999500002 399999999999500003 399999999999500004 399999999999500005 399999999999500006 399999999999500007 399999999999500008 399999999999500009 399999999999500010 399999999999500011 399999999999500012 399999999999500013 399999999999500014 399999999999500015 399999999999500016 399999...
output:
YES 2 3 4 5
result:
ok OK
Test #15:
score: 0
Accepted
time: 61ms
memory: 9056kb
input:
500000 3 399999999999500002 399999999999500003 399999999999500004 399999999999500005 399999999999500006 399999999999500007 399999999999500008 399999999999500009 399999999999500010 399999999999500011 399999999999500012 399999999999500013 399999999999500014 399999999999500015 399999999999500016 399999...
output:
YES 2 3 4 5
result:
ok OK
Test #16:
score: 0
Accepted
time: 0ms
memory: 3468kb
input:
10 1 2 3 9 36 360 13320 4808520 64054294920 308006422263013320
output:
NO
result:
ok OK
Test #17:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
9 1 2 3 9 36 360 13320 4808520 64054294920
output:
NO
result:
ok OK
Test #18:
score: 0
Accepted
time: 1ms
memory: 3512kb
input:
10 3861348309891 127439409255713 551948644892279 2552834525268279 19417204359723670 102703824912373168 336410714638229509 857014049592511384 918060937762570344 992825966112149288
output:
NO
result:
ok OK
Test #19:
score: 0
Accepted
time: 1ms
memory: 3508kb
input:
10 374432361454 3518670391085 108003930276680 1335172630640345 8456849498329971 36786273792403923 120085800577991088 318281777133095838 383067822022773917 697280279299110793
output:
NO
result:
ok OK
Test #20:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
11 903698880731 8661804054951 46413148737609 2047329226174757 6320772683571604 21145056521166311 53518443870119450 151094208662606815 620225829430430781 643358709747358736 987761154108547529
output:
NO
result:
ok OK
Test #21:
score: 0
Accepted
time: 1ms
memory: 3440kb
input:
16 1 2 6 30 210 2310 30030 510510 9699690 223092870 6469693230 200560490130 7420738134810 304250263527210 13082761331670030 614889782588491410
output:
NO
result:
ok OK
Test #22:
score: 0
Accepted
time: 1ms
memory: 3508kb
input:
23 1 2 4 32 256 3328 43264 129792 389376 2336256 14017536 70087680 350438400 3504384000 35043840000 245306880000 1717148160000 24040074240000 336561039360000 3702171432960000 40723885762560000 692306057963520000 692306057963520001
output:
NO
result:
ok OK
Test #23:
score: 0
Accepted
time: 1ms
memory: 3452kb
input:
24 1 2 4 32 256 3328 43264 129792 389376 2336256 14017536 70087680 350438400 3504384000 35043840000 245306880000 1717148160000 24040074240000 336561039360000 3702171432960000 40723885762560000 692306057963520000 692306057963520001 692306057963520002
output:
NO
result:
ok OK
Test #24:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
25 1 2 4 32 256 3328 43264 129792 389376 2336256 14017536 70087680 350438400 3504384000 35043840000 245306880000 1717148160000 24040074240000 336561039360000 3702171432960000 40723885762560000 692306057963520000 692306057963520001 692306057963520002 692306057963520003
output:
YES 22 23 24 25
result:
ok OK
Test #25:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
26 1 2 4 32 256 3328 43264 129792 389376 2336256 14017536 70087680 350438400 3504384000 35043840000 245306880000 1717148160000 24040074240000 336561039360000 3702171432960000 40723885762560000 692306057963520000 692306057963520001 692306057963520002 692306057963520003 692306057963520004
output:
YES 22 23 24 25
result:
ok OK
Test #26:
score: 0
Accepted
time: 64ms
memory: 9080kb
input:
500000 1 2 4 32 256 3328 43264 129792 389376 2336256 14017536 70087680 350438400 3504384000 35043840000 245306880000 1717148160000 24040074240000 336561039360000 3702171432960000 40723885762560000 692306057963520000 692306057963520001 692306057963520002 692306057963520003 692306057963520004 69230605...
output:
YES 22 23 24 25
result:
ok OK
Test #27:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
6 20122422218883239 56278710347381443 247237730275417133 286111661631847944 354848159244882586 964700009339386544
output:
YES 1 2 5 6
result:
ok OK
Test #28:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
8 390276856793488 1152876923982673 6982441155075473 26146320000665894 45310164832331696 87593483686155752 366720093455746367 863464306708560705
output:
YES 1 2 7 8
result:
ok OK
Test #29:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
9 61307755780486 129326614955470 1118666378585854 9719828040294917 48313589660444318 242156755123277778 312272361787807645 339925101639750428 941720167539522416
output:
YES 1 2 8 9
result:
ok OK
Test #30:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
25 1 2 4 32 256 3328 43264 129792 389376 2336256 14017536 70087680 350438400 3504384000 35043840000 245306880000 1717148160000 24040074240000 336561039360000 3702171432960000 40723885762560000 488686629150720000 488686629150720001 488686629150720002 977373258301440004
output:
YES 1 2 22 25
result:
ok OK
Test #31:
score: 0
Accepted
time: 1ms
memory: 3672kb
input:
25 1 2 4 32 256 3328 43264 129792 389376 2336256 14017536 70087680 350438400 3504384000 35043840000 245306880000 1717148160000 24040074240000 336561039360000 3702171432960000 40723885762560000 40723885762560001 40723885762560002 488686629150720024 977373258301440048
output:
YES 1 2 24 25
result:
ok OK
Test #32:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
16 1 2 4 32 256 768 2304 13824 82944 414720 2073600 14515200 101606400 101606401 101606402 10323860825779202
output:
YES 1 14 15 16
result:
ok OK
Test #33:
score: 0
Accepted
time: 1ms
memory: 3564kb
input:
16 1 101606400 101606401 101606402 203212804 406425608 3251404864 26011238912 78033716736 234101150208 1404606901248 8427641407488 42138207037440 210691035187200 1474837246310400 10323860724172800
output:
YES 1 2 3 16
result:
ok OK