Submission #28086

# Submission time Handle Problem Language Result Execution time Memory
28086 2017-07-15T10:20:31 Z tlwpdus 팬클럽 회장(#1197, kdh9949) The Ant and The Bitcoin (FXCUP2_ant) C++14
0 / 1
0 ms 2800 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int n, k;
ll l, t, x[100010], bx;

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);
		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;
	}
	scanf("%d", &k);
	bx = x[k];
	sort(x + 1, x + n + 1);
	printf("%d\n", int(lower_bound(x + 1, x + n + 1, bx) - x));
}

Compilation message

ant.cpp: In function 'int main()':
ant.cpp:9: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:12: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:27:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &k);
                 ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2800 KB Output is correct
2 Incorrect 0 ms 2800 KB Output isn't correct
3 Halted 0 ms 0 KB -