Submission #95422

#TimeUsernameProblemLanguageResultExecution timeMemory
95422Retro3014복사 붙여넣기 2 (JOI15_copypaste2)C++17
100 / 100
250 ms8700 KiB
#include <iostream> #include <vector> #include <algorithm> #include <stdio.h> #include <string> using namespace std; int K, M, N; string str; struct S{ int a, b, c; }; vector<S> v; int main(){ scanf("%d%d", &K, &M); cin>>str; scanf("%d", &N); for(int i=0; i<N; i++){ S tmp; scanf("%d%d%d", &tmp.a, &tmp.b, &tmp.c); tmp.b--; v.push_back(tmp); } for(int index=0; index<K; index++){ int idx = index; for(int i=v.size()-1; i>=0; i--){ //cout<<idx<<" "; int s = v[i].c, e = v[i].c-v[i].a+v[i].b; if(idx<s){ continue; }else if(s<=idx && idx<=e){ idx = idx-v[i].c+v[i].a; }else{ idx-=(e-s+1); } } //cout<<endl; printf("%c", str[idx]); } return 0; }

Compilation message (stderr)

copypaste2.cpp: In function 'int main()':
copypaste2.cpp:17:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &K, &M);
  ~~~~~^~~~~~~~~~~~~~~~
copypaste2.cpp:19:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
  ~~~~~^~~~~~~~~~
copypaste2.cpp:22:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d%d", &tmp.a, &tmp.b, &tmp.c);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...