Submission #74354

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
743542018-08-31 11:01:37khsoo01The Ant and The Bitcoin (FXCUP2_ant)C++11
1 / 1
50 ms12220 KiB
#include<bits/stdc++.h>
#define X first
#define Y second
using namespace std;
typedef long long ll;
ll n, l, t, x, d[100005];
pair<ll, ll> a[100005];
bool f[100005];
int main()
{
scanf("%lld%lld%lld",&n,&l,&t);
for(ll i=1;i<=n;i++) {
char T[2]; a[i].Y = i;
scanf("%lld%s",&a[i].X,T);
if(T[0] == 'L') f[i] = true;
}
scanf("%lld",&x);
sort(a+1, a+1+n);
for(ll i=1;i<=n;i++) {
d[i] = a[i].Y;
a[i].Y = (d[i] == x);
if(f[d[i]]) 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;
}
sort(a+1, a+1+n);
for(ll i=1;i<=n;i++) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

ant.cpp: In function 'int main()':
ant.cpp:13:7: 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:16:8: 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:19:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&x);
  ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...