Submission #431529

# Submission time Handle Problem Language Result Execution time Memory
431529 2021-06-17T12:43:48 Z saleh Comparing Plants (IOI20_plants) C++17
0 / 100
11 ms 14312 KB
#include "plants.h"//
#include <bits/stdc++.h>


using namespace std;

const int MAXN = 200 * 1000 + 23;//, INF = 1e6;


int n;
vector<int> v[MAXN], ps[MAXN], ind[MAXN], R;


void init(int k, vector<int> r) {
	R = r;
	n = r.size();
	if (k == 2) {
		int tmp = -1;
		for (int i = 1; i <= n; i++) if (r[i % n] != r[i - 1]) tmp = i;
		int cnt = 0;
		v[0].push_back(tmp);
		ps[tmp].push_back(0);
		ind[tmp].push_back(0);
		for (int i = 1; i <= n; i++) if (r[(tmp + i - 1) % n] == r[(tmp + i) % n]) {
			v[cnt].push_back((tmp + i) % n);
			ps[(tmp + i) % n].push_back(cnt);
			ind[(tmp + i) % n].push_back(v[cnt].size() - 1);
		} else {
			v[cnt].push_back((tmp + i) % n);
			ps[(tmp + i) % n].push_back(cnt);
			ind[(tmp + i) % n].push_back(v[cnt].size() - 1);
			cnt++;
			v[cnt].push_back((tmp + i) % n);
			ps[(tmp + i) % n].push_back(cnt);
			ind[(tmp + i) % n].push_back(v[cnt].size() - 1);
		}
	} else if (k * 2 > n && n <= 5000) {
		
	}
	return;
}

int compare_plants(int x, int y) {
	for (int i = 0; i < ps[x].size(); i++) for (int j = 0; j < ps[y].size(); j++) if (ps[x][i] == ps[y][j])
		return (R[x] == ((ind[x][i] < ind[y][i])? 1: 0))? -1: 1;
	return 0;
}

//int main() {}//

Compilation message

plants.cpp: In function 'int compare_plants(int, int)':
plants.cpp:44:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |  for (int i = 0; i < ps[x].size(); i++) for (int j = 0; j < ps[y].size(); j++) if (ps[x][i] == ps[y][j])
      |                  ~~^~~~~~~~~~~~~~
plants.cpp:44:59: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |  for (int i = 0; i < ps[x].size(); i++) for (int j = 0; j < ps[y].size(); j++) if (ps[x][i] == ps[y][j])
      |                                                         ~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 14312 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 14284 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 14284 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 14252 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 14284 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 14304 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 14312 KB Output isn't correct
2 Halted 0 ms 0 KB -