Submission #1254479

#TimeUsernameProblemLanguageResultExecution timeMemory
1254479tkm_algorithmsMigrations (IOI25_migrations)C++20
Compilation error
0 ms0 KiB
/**
*    In the name of Allah
*    We are nothing and you're everything
*    Ya Muhammad!
**/
#include <bits/stdc++.h>
#include "migrations.h"
using namespace std;

#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define mp(x, y) make_pair(x, y)
const char nl = '\n';
const int N = 1e4+5;
int a[N], cnt = 1, mx = 0, id = 0, gos = 0, was = 0;

int send_message(int n, int i, int pi) {
	a[i] = a[pi]+1;
	cnt += 1;
	if (mx<a[i])gos += i-was, mx = a[i], was = i;
	if (cnt == n) {
		if (gos==211)return 211;
		if (gos==-211)return 212;
		if (gos>0)return 215+gos;
		if (gos<0)return 211+gos
	}
	if (gos >= 211) {
		gos -= 211;
		was = i;
		return 211;
	} 
	if (gos <=-211) {
		gos += 211;
		was = i;
		return 212;
	}
	return 0;
}

std::pair<int, int> longest_path(std::vector<int> s) {
	memset(a, 0, sizeof a);
	cnt = 1, mx = 0, id = 0, gos = was = 0;
	int res = 0;
	for (int i = 1; i < sz(s); ++i) {
		if (s[i] == 0)continue;
		if (s[i] == 211)res += 211;
		else if (s[i] == 212)res -= 212;
		else if (s[i]>215)res = res+s[i]-215;
		else res = res+s[i]-211;
	}
	return {0, res};
}
 

Compilation message (stderr)

migrations.cpp: In function 'int send_message(int, int, int)':
migrations.cpp:25:41: error: expected ';' before '}' token
   25 |                 if (gos<0)return 211+gos
      |                                         ^
      |                                         ;
   26 |         }
      |         ~