QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#484317#6348. Egor Has a ProblemzdczdcWA 44ms7632kbC++141.1kb2024-07-19 17:30:432024-07-19 17:30:43

Judging History

你现在查看的是最新测评结果

  • [2024-07-19 17:30:43]
  • 评测
  • 测评结果:WA
  • 用时:44ms
  • 内存:7632kb
  • [2024-07-19 17:30:43]
  • 提交

answer

#include <bits/stdc++.h>
#define ALL(x) begin(x), end(x)
#define All(x, l, r) &x[l], &x[r] + 1
using namespace std;
void file() {
  freopen("1.in", "r", stdin);
  freopen("1.out", "w", stdout);
}
using ll = long long;
template <typename T> using vec = vector<T>;

const int kLim = 5e5 + 5;
int n;
array<ll, kLim> a;

int32_t main() {
//  file();
  ios::sync_with_stdio(0); cin.tie(0);
  cin >> n;
  for(int i = 1; i <= n; i++) cin >> a[i];
  if(n <= 100) {
    for(int i = 1; i <= n; i++)
      for(int j = i + 1; j <= n; j++)
        for(int k = j + 1; k <= n; k++)
          for(int p = k + 1; p <= n; p++)
            if(a[j] / a[i] == a[p] / a[k]) {
              cout << "YES\n";
              cout << i << " " << j << " " << k << " " << p << "\n";
              return 0;
            }
    return cout << "NO\n", 0;
  }
  for(int i = 1; i < n; i++)
    if(a[i + 1] / a[i] == 1) {
      cout << i << " " << i + 1 << " ";
      break;
    }
  for(int i = n - 1; i; i--)
    if(a[i + 1] / a[i] == 1) {
      cout << i << " " << i + 1 << "\n";
      break;
    }
  return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3608kb

input:

6
2 6 11 21 47 120

output:

YES
1 3 4 6

result:

ok OK

Test #2:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

5
1 2 6 30 210

output:

NO

result:

ok OK

Test #3:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

4
7 13 77 143

output:

YES
1 2 3 4

result:

ok OK

Test #4:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

4
10 29 31 100

output:

NO

result:

ok OK

Test #5:

score: -100
Wrong Answer
time: 44ms
memory: 7632kb

input:

500000
627045176858 4817409059014 6288122580263 11138485427254 14292718094002 14799874839768 16926890883539 17617152313162 17645472255619 18208915248631 22963632241827 24466999302606 25551903318615 26091633648017 38200644379849 39885775205129 40036378248650 40309675851194 40773414900416 408933438176...

output:

2 3 499999 500000

result:

wrong answer Token "2" doesn't correspond to pattern "NO|YES"