Submission #1075243

#TimeUsernameProblemLanguageResultExecution timeMemory
1075243raduvTreasure (info1cup19_treasure)C++17
100 / 100
2 ms604 KiB
#include <bits/stdc++.h> #define DEBUG 1 using namespace std; const int MAXN = 200'000; int stiva[MAXN + 1][2]; int ns; int main() { char ch; int n, k, i; scanf("%d%d ", &n, &k); for( i = 0; i < n; i++ ){ ch = fgetc(stdin); ch -= 'a'; if(ns > 0 && stiva[ns][0] == ch){ stiva[ns][1]++; if(stiva[ns][1] == k){ stiva[ns][1] = 0; stiva[ns][0] = 0; ns--; } } else{ ns++; stiva[ns][0] = ch; stiva[ns][1] = 1; } } for( i = 1; i <= ns; i++ ){ while(stiva[i][1] > 0){ fputc(stiva[i][0] + 'a', stdout); stiva[i][1]--; } } fputc('\n', stdout); return 0; }

Compilation message (stderr)

treasure.cpp: In function 'int main()':
treasure.cpp:10:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |   scanf("%d%d ", &n, &k);
      |   ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...