제출 #1286509

#제출 시각아이디문제언어결과실행 시간메모리
1286509ggillianjiang코끼리 (Dancing Elephants) (IOI11_elephants)C++20
컴파일 에러
0 ms0 KiB
#include <iostream> #include <cstdio> #include <vector> #include <utility> using namespace std; #define loop(s) for (int a = 0; a < s; ++a) using vec_t = vector<int>; using p_t = pair<int, pair<int, int>>; using vp_t = vector<p_t>; using vv_t = vector<vector<int>>; int n, l, least; vv_t frames; int update(int i, int y) { int si = frames[i / l].size(); loop(frames[i / l].size()) { int b = frames[i / l][a]; if (b == -1) continue; else if (b == i){ if(a == si - 1) frames[i / l].pop_back(); else b = -1; if(si==1) least --; break; } } int sy = frames[y / l].size(); if (sy == 0) least++; frames[y / l].push_back(y); printf("%d", least); return least; } void init(int N, int L, int X[]) { int M, i, y; n = N; l = L; scanf("%d", &M); loop(sizeof(*X) / sizeof(X[0])) { frames[X[a] / l].push_back(X[a]); if (X[a] / l != X[a - 1] / l) least++; } printf("%d", least); loop(M) { scanf("%d %d", &i, &y); update(i, y); } } int main() { int i, n, l; scanf("%d %d", &n, &l); int X[n]; loop(n) { scanf("%d", &X[a]); } init(n, l, X); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

elephants.cpp: In function 'void init(int, int, int*)':
elephants.cpp:54:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   54 |     scanf("%d", &M);
      |     ~~~~~^~~~~~~~~~
elephants.cpp:67:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   67 |         scanf("%d %d", &i, &y);
      |         ~~~~~^~~~~~~~~~~~~~~~~
elephants.cpp: In function 'int main()':
elephants.cpp:77:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   77 |     scanf("%d %d", &n, &l);
      |     ~~~~~^~~~~~~~~~~~~~~~~
elephants.cpp:83:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   83 |         scanf("%d", &X[a]);
      |         ~~~~~^~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccjDtWHO.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccCBIjVb.o:elephants.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status