Source Code
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <stdio.h>
#include<iterator>
using namespace std;
typedef long long ll;
const double pi = acos(-1);
const int oo = 1e9 + 10;
const int mod = 1e9 + 7;
const int N = 1e6;
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
void solve() {
    srand(time(NULL));
	int n;
	n = 1000000;
	map<int, int>lst;
	int mx = 0;
	for (int i = 1; i <= n; i++) {
		int x;
		x = 1ll * rand() * rand() % 1000000000;
		if (lst[x] == 0)
			lst[x] = i;
		mx = max(mx, ((i - lst[x]) + 1));
	}
	printf("%d\n", mx);
}
int t;
int main() {
	//freopen("input.txt", "r", stdin);
	//scanf("%d", &t);
	//while (t--) solve();
	solve();
}
Copy
Good Segment Light
GNU G++17
1232 ms
47.2 MB
Wrong Answer