QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#647005#1212. Navigationfast_photonCompile Error//C++14862b2024-10-17 10:54:052024-10-17 10:54:06

Judging History

你现在查看的是最新测评结果

  • [2024-10-17 10:54:06]
  • 评测
  • [2024-10-17 10:54:05]
  • 提交

Anna

#include "Annalib.h"
#include<vector>
#include<queue>

using namespace std;

int dis[100005], h[100005], en;
queue<int> q;
struct edge {
	int v, next;
} e[200005];
void add(int u, int v) {
	e[en] = (edge){v, h[u]}; h[u] = en++;
}

void Anna(int K, int N, int T, int A[], int B[]) {
	memset(dis, 0x3f, sizeof(dis));
	memset(h, 0xff, sizeof(h));
	en = 0;
	for(int i = 0; i < N - 1; i++) add(A[i], B[i]), add(B[i], A[i]);
	q.push(T);
	dis[T] = 1;
	while(!q.empty()) {
		int r = q.front(); q.pop();
		Flag(r, dis[r]);
		for(int j = h[r]; ~j; j = e[j].next) {
			int v = e[j].v;
			if(dis[v] > dis[r] + 1) {
				dis[v] = dis[r] + 1;
				q.push(v);
			}
		}
	}
}

Bruno

#include "Brunolib.h"

void Bruno(int K, int S, int F, int L, int P[], int Q[]) {
	for(int i =  0; i < L; i++) {
		if(Q[i] < F) F = Q[i], S = P[i];
	}
	Answer(S);
}

Details

Anna.code: In function ‘void Anna(int, int, int, int*, int*)’:
Anna.code:17:9: error: ‘memset’ was not declared in this scope
   17 |         memset(dis, 0x3f, sizeof(dis));
      |         ^~~~~~
Anna.code:4:1: note: ‘memset’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
    3 | #include<queue>
  +++ |+#include <cstring>
    4 | 
grader.cpp: In function ‘int main(int, char**)’:
grader.cpp:144:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  144 |         scanf("%d%d%d%d", &K, &S, &F, &L);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
grader.cpp:146:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  146 |                 scanf("%d", &P_[i]);
      |                 ~~~~~^~~~~~~~~~~~~~
grader.cpp:150:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  150 |                 scanf("%d", &Q_[i]);
      |                 ~~~~~^~~~~~~~~~~~~~