제출 #28095

#제출 시각아이디문제언어결과실행 시간메모리
28095tlwpdus 팬클럽 회장 (#71)개미와 비트코인 (FXCUP2_ant)C++14
0 / 1
0 ms5536 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; int n, k, p[100010]; ll l, t, bx; pll ix[100010], x[100010]; int main(){ scanf("%d%lld%lld", &n, &l, &t); for(int i = 1; i <= n; i++){ char buf[3]; ll cx; scanf("%lld%s", &cx, buf); ix[i] = {cx, i}; if(buf[0] == 'R'){ cx += t; cx %= 2 * l; if(cx > l) cx = 2 * l - cx; } else{ cx = l - cx; cx += t; cx %= 2 * l; if(cx > l) cx = 2 * l - cx; cx = l - cx; } x[i] = {cx, i}; } scanf("%d", &k); sort(ix + 1, ix + n + 1); sort(x + 1, x + n + 1); for(int i = 1; i <= n; i++){ if(ix[i].second == k){ k = i; break; } } printf("%d\n", x[k].second); }

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

ant.cpp: In function 'int main()':
ant.cpp:39:28: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
  printf("%d\n", x[k].second);
                            ^
ant.cpp:11:33: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%lld%lld", &n, &l, &t);
                                 ^
ant.cpp:14:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld%s", &cx, buf);
                            ^
ant.cpp:30:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &k);
                 ^
#Verdict Execution timeMemoryGrader output
Fetching results...