Submission #199117

# Submission time Handle Problem Language Result Execution time Memory
199117 2020-01-29T12:10:41 Z godwind Dancing Elephants (IOI11_elephants) C++17
26 / 100
9000 ms 2168 KB
// O O O O O O O O O O O O O O O OO O OO O OO O O O TTCH O TTTCH O TTTCH O O O O
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx")
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <cstdio>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <random>
#include <iomanip>
#include <bitset>
#include <cassert>
 
// #include "grader.h"

using namespace std;


#define y1 y11
#define double long double
#define less less228
#define left left228
#define right right228
#define list list228

template<typename T> void uin(T &a, T b) {
    if (b < a) a = b;
}
template<typename T> void uax(T &a, T b) {
    if (b > a) a = b;
}

const int N = 150 * 1000 + 228;

int n, l;
pair<int, int> x[N];


int update(int id, int nv) {
	int i;
	for (i = 0; i < n; ++i) {
		if (x[i].second == id) {
			x[i].first = nv;
			while (i && x[i].first < x[i - 1].first) {
				swap(x[i], x[i - 1]); --i;
			}
			while (i + 1 < n && x[i].first > x[i + 1].first) {
				swap(x[i], x[i + 1]); ++i;
			}
			break;
		}
	}
	int res = 1;
	int s = x[0].first;
	for (i = 0; i < n; ++i) {
		if (x[i].first > s + l) {
			s = x[i].first;
			++res;
		}
	}
	return res;
}

void init(int nnnn, int llll, int xs[]) {
	n = nnnn;
	l = llll;
	for (int i = 0; i < n; ++i) {
		x[i].first = xs[i];
		x[i].second = i;
	}
    return;
}

// int xx[100];

// signed main() {
// 	cin >> n >> l;
// 	for (int i = 0; i < n; ++i) {
// 		cin >> xx[i];
// 	}
// 	init(n, l, xx);
// 	while (1) {
// 		int i, j;
// 		cin >> i >> j;
// 		cout << update(i, j) << '\n';
// 	}
// 	return 0;
// }





# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 252 KB Output is correct
7 Correct 809 ms 1144 KB Output is correct
8 Correct 1302 ms 1784 KB Output is correct
9 Correct 1643 ms 2168 KB Output is correct
10 Execution timed out 9086 ms 2040 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 252 KB Output is correct
7 Correct 809 ms 1144 KB Output is correct
8 Correct 1302 ms 1784 KB Output is correct
9 Correct 1643 ms 2168 KB Output is correct
10 Execution timed out 9086 ms 2040 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 252 KB Output is correct
7 Correct 809 ms 1144 KB Output is correct
8 Correct 1302 ms 1784 KB Output is correct
9 Correct 1643 ms 2168 KB Output is correct
10 Execution timed out 9086 ms 2040 KB Time limit exceeded
11 Halted 0 ms 0 KB -