/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 540.0 KiB
#2 Accepted 6ms 588.0 KiB
#3 Accepted 7ms 588.0 KiB
#4 Wrong Answer 7ms 488.0 KiB
#5 Accepted 6ms 528.0 KiB
#6 Accepted 7ms 488.0 KiB
#7 Wrong Answer 7ms 508.0 KiB
#8 Wrong Answer 3ms 584.0 KiB
#9 Wrong Answer 2ms 492.0 KiB
#10 Wrong Answer 6ms 588.0 KiB
#11 Wrong Answer 2ms 476.0 KiB
#12 Wrong Answer 4ms 596.0 KiB
#13 Wrong Answer 7ms 496.0 KiB
#14 Wrong Answer 5ms 588.0 KiB
#15 Wrong Answer 6ms 692.0 KiB

Code

// @sagorahmedmunna

#include <bits/stdc++.h>
using namespace std;

void test() {
  int n, k;
  cin >> n >> k;
  string a[n];
  for (auto& ai : a) {
    cin >> ai;
  }
  string mx = "";
  for (int i = 0; i < n; i++) {
    string temp = "";
    int cnt = -1;
    for (int j = i; j < n; j++) {
      temp += a[j];
      cnt++;
      if (cnt == k) break;
    }
    mx = max(mx, temp);
  }
  cout << mx << '\n';
}

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int t = 1; 
  cin >> t;
  for (int i = 1; i <= t; i++) {
    test();
  }
  return 0;
}

Information

Submit By
Type
Submission
Problem
P1083 Number concatenation
Contest
Bangladesh 2.0
Language
C++20 (G++ 13.2.0)
Submit At
2024-08-16 15:50:20
Judged At
2024-10-03 13:29:43
Judged By
Score
25
Total Time
7ms
Peak Memory
692.0 KiB