QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#647000#1212. Navigationfast_photonCompile Error//C++14845b2024-10-17 10:53:242024-10-17 10:53:25

Judging History

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

  • [2024-10-17 10:53:25]
  • 评测
  • [2024-10-17 10:53:24]
  • 提交

Anna

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

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:7:1: error: ‘queue’ does not name a type
    7 | queue<int> q;
      | ^~~~~
Anna.code: In function ‘void add(int, int)’:
Anna.code:12:18: error: ‘edge’ was not declared in this scope; did you mean ‘Edge’?
   12 |         e[en] = (edge){v, h[u]}; h[u] = en++;
      |                  ^~~~
      |                  Edge
Anna.code: In function ‘void Anna(int, int, int, int*, int*)’:
Anna.code:16:9: error: ‘memset’ was not declared in this scope
   16 |         memset(dis, 0x3f, sizeof(dis));
      |         ^~~~~~
Anna.code:3:1: note: ‘memset’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
    2 | #include<vector>
  +++ |+#include <cstring>
    3 | 
Anna.code:20:9: error: ‘q’ was not declared in this scope
   20 |         q.push(T);
      |         ^
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]);
      |                 ~~~~~^~~~~~~~~~~~~~