Submission #198920

#TimeUsernameProblemLanguageResultExecution timeMemory
198920arnold518복사 붙여넣기 2 (JOI15_copypaste2)C++14
100 / 100
316 ms12536 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 2e5; int K, N; ll A[MAXN+10], B[MAXN+10], C[MAXN+10], D[MAXN+10]; char S[MAXN+10]; int main() { int i, j; scanf("%d%*d%s%d", &K, S, &N); for(i=1; i<=N; i++) { scanf("%lld%lld%lld", &A[i], &B[i], &C[i]); B[i]--; D[i]=C[i]+B[i]-A[i]; } for(i=0; i<K; i++) { int pos=i; for(j=N; j>=1; j--) { if(C[j]<=pos && pos<=D[j]) pos=pos-C[j]+A[j]; else if(D[j]<pos) pos-=D[j]-C[j]+1; } printf("%c", S[pos]); } }

Compilation message (stderr)

copypaste2.cpp: In function 'int main()':
copypaste2.cpp:18:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%*d%s%d", &K, S, &N);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
copypaste2.cpp:21:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld%lld%lld", &A[i], &B[i], &C[i]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...