Submission #1061781

# Submission time Handle Problem Language Result Execution time Memory
1061781 2024-08-16T13:22:14 Z rainboy Magic Show (APIO24_show) C++17
Compilation error
0 ms 0 KB
#include "Alice.h"
#include <vector>

typedef pair<int, int> pi;
typedef vector<pi> vpi;

const int N = 5000;

vpi Alice() {
	long long x = setN(N);
	vpi ij;
	for (int j = 1; j < N; j++) {
		int i = x % j;
		ij.push_back(make_pair(i + 1, j + 1));
	}
	return ij;
}
#include "Bob.h"
#include <vector>

using namespace std;

typedef pair<int, int> pi;
typedef vector<pi> vpi;

long long Bob(vpi ij) {
	const long long M = 1000000000000000000;
	int m;
	long long md = 1, x = 0;
	for (int h = 0; h < m && md <= M; h++) {
		int i = ij[h].first - 1, j = ij[h].second - 1;
		while (x % j != i)
			x += md;
		int k = 1;
		while (md * k <= M && md * k % j != 0)
			k++;
		md *= k;
	}
	return x;
}

Compilation message

Alice.cpp:4:9: error: 'pair' does not name a type
    4 | typedef pair<int, int> pi;
      |         ^~~~
Alice.cpp:5:9: error: 'vector' does not name a type
    5 | typedef vector<pi> vpi;
      |         ^~~~~~
Alice.cpp:9:1: error: 'vpi' does not name a type
    9 | vpi Alice() {
      | ^~~

Bob.cpp: In function 'long long int Bob(vpi)':
Bob.cpp:13:20: warning: 'm' is used uninitialized in this function [-Wuninitialized]
   13 |  for (int h = 0; h < m && md <= M; h++) {
      |                  ~~^~~