답안 #28124

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
28124 2017-07-15T11:25:40 Z Shocking Hot(#1201, khsoo01) 개미와 비트코인 (FXCUP2_ant) C++14
0 / 1
0 ms 3580 KB
#include<bits/stdc++.h>
#define X first
#define Y second
using namespace std;
typedef long long ll;
ll n, l, t, x;
pair<ll, ll> a[100005];

int main()
{
	scanf("%lld%lld%lld",&n,&l,&t);
	for(ll i=1;i<=n;i++) {
		char T[2];
		scanf("%lld%s",&a[i].X,T);
		if(T[0] == 'L') a[i].X -= t;
		else a[i].X += t;
		a[i].X = (a[i].X % (2*l) + 2*l) % (2*l);
		if(a[i].X >= l) a[i].X = 2*l - a[i].X;
	}
	scanf("%lld",&x);
	a[x].Y = 1;
	sort(a+1, a+1+n);
	for(ll i=1;i<=n;i++) {
		if(a[i].Y) {printf("%lld\n",i); return 0;}
	}
}

Compilation message

ant.cpp: In function 'int main()':
ant.cpp:11:32: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld%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",&a[i].X,T);
                            ^
ant.cpp:20:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&x);
                  ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3580 KB Output is correct
2 Incorrect 0 ms 3580 KB Output isn't correct
3 Halted 0 ms 0 KB -