QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#117922#6348. Egor Has a Problemfeeder1#WA 26ms7348kbC++141.3kb2023-07-02 15:42:342023-07-02 15:42:36

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-02 15:42:36]
  • 评测
  • 测评结果:WA
  • 用时:26ms
  • 内存:7348kb
  • [2023-07-02 15:42:34]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef tuple<int, int, int> tii;
typedef tuple<ll, ll, ll> tll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define nl "\n"
#define all(v) v.begin(),v.end()
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define sz(x) (int)(x).size()

const int maxn = 5e5 + 5;

ll n, m, q, k, t, a, b, c;
ll arr[maxn];

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> arr[i];
	} 
	if (n >= 100) {
		map<ll, int> ma;
		cout << "YES\n";
		for (int i = 2; i <= n; i++) {
			ll x = arr[i] / arr[i - 1];
			if (ma[x] != 0) {
				cout << ma[x] - 1 << " " << ma[x] << " " << i - 1 << " " << i << nl;
				break;
			}
			ma[x] = i;
		}
		return 0;
	}
	bool ok = false;
	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 l = k + 1; l <= n; l++) {
					if (ok) break;
					if (arr[j] /  arr[i] == arr[l] / arr[k]) {
						cout << "YES\n";
						cout << i << " " << j << " " << k << " " << l << nl;
						ok = true;
					}
				}
			}
		}
	}
	if (!ok) cout << "NO\n";
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 3388kb

input:

5
1 2 6 30 210

output:

NO

result:

ok OK

Test #3:

score: 0
Accepted
time: 1ms
memory: 3484kb

input:

4
7 13 77 143

output:

YES
1 2 3 4

result:

ok OK

Test #4:

score: 0
Accepted
time: 1ms
memory: 3460kb

input:

4
10 29 31 100

output:

NO

result:

ok OK

Test #5:

score: -100
Wrong Answer
time: 26ms
memory: 7348kb

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 3 4

result:

wrong answer 4 indices should be in increasing order