Submission #26923857


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
#define N 1000005
#define int long long
#define sz(c) (int)c.size()
#define fr first
#define ll long long 
#define sc second
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a ; i<n ; i++)
#define r0 return 0;
#define endl '\n'
#define INF (int)1e15

const int M = 1000000007;
const int U = 998244353;

/* Debug Begins */ 
# define trace(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(bool f) { if(f) return "True"; else return "False";}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
template<typename A, typename B> string to_string(pair<A, B> p){
  return "(" + to_string(p.first) + ": " + to_string(p.second) + ")";}
template<typename A> string to_string(A v) {bool f = false; string r = "{"; 
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r; 
  for (auto x: v) r += "\n" + to_string(x); return r;}
int Nerr;
template<typename A> string to_string(A *p) {return to_string(vector<A>(p, p + Nerr));}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
#define Lu(...) [&] (auto &&u) { return __VA_ARGS__; }
#define Luv(...) [&] (auto &&u, auto &&v) { return __VA_ARGS__; }
/***************************************************************/



signed main()
{
    ios_base::sync_with_stdio(0);
    int TESTS=1;
    // cin>>TESTS;
    while(TESTS--)
    {   
        int n, k;
        cin >> n >> k;
        vector<string> s(n);
        rep(i,0,n) cin >> s[i];
        sort(all(s), [&](const string& a, const string& b) {
            string s1 = a + b;
            string s2 = b + a;
            return s1 < s2;
        });
        string ans;
        rep(i,0,k) ans.append(s[i]);
        cout << ans << endl;
    }
}

Submission Info

Submission Time
Task F - String Cards
User adarshagr8
Language C++ (GCC 9.2.1)
Score 0
Code Size 2443 Byte
Status WA
Exec Time 7 ms
Memory 3604 KiB

Compile Error

./Main.cpp: In function ‘std::string to_string(std::vector<std::vector<_Tp> >)’:
./Main.cpp:34:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
   34 |   for (auto x: v) r += "\n" + to_string(x); return r;}
      |   ^~~
./Main.cpp:34:45: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
   34 |   for (auto x: v) r += "\n" + to_string(x); return r;}
      |                                             ^~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 2
AC × 27
WA × 31
Set Name Test Cases
Sample example0.txt, example1.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, 027.txt, 028.txt, 029.txt, 030.txt, 031.txt, 032.txt, 033.txt, 034.txt, 035.txt, 036.txt, 037.txt, 038.txt, 039.txt, 040.txt, 041.txt, 042.txt, 043.txt, 044.txt, 045.txt, 046.txt, 047.txt, 048.txt, 049.txt, 050.txt, 051.txt, 052.txt, 053.txt, 054.txt, 055.txt, example0.txt, example1.txt
Case Name Status Exec Time Memory
000.txt WA 7 ms 3580 KiB
001.txt AC 2 ms 3492 KiB
002.txt AC 2 ms 3528 KiB
003.txt AC 3 ms 3584 KiB
004.txt AC 2 ms 3524 KiB
005.txt AC 2 ms 3500 KiB
006.txt WA 2 ms 3552 KiB
007.txt WA 2 ms 3596 KiB
008.txt AC 3 ms 3556 KiB
009.txt AC 2 ms 3600 KiB
010.txt AC 2 ms 3500 KiB
011.txt AC 1 ms 3540 KiB
012.txt AC 2 ms 3536 KiB
013.txt AC 3 ms 3580 KiB
014.txt AC 2 ms 3544 KiB
015.txt AC 2 ms 3540 KiB
016.txt AC 2 ms 3460 KiB
017.txt AC 2 ms 3600 KiB
018.txt AC 2 ms 3540 KiB
019.txt AC 2 ms 3496 KiB
020.txt WA 2 ms 3492 KiB
021.txt AC 3 ms 3452 KiB
022.txt WA 2 ms 3492 KiB
023.txt AC 3 ms 3576 KiB
024.txt AC 2 ms 3484 KiB
025.txt AC 2 ms 3428 KiB
026.txt AC 3 ms 3596 KiB
027.txt AC 2 ms 3520 KiB
028.txt AC 2 ms 3580 KiB
029.txt AC 2 ms 3432 KiB
030.txt WA 2 ms 3592 KiB
031.txt WA 2 ms 3444 KiB
032.txt WA 2 ms 3488 KiB
033.txt WA 2 ms 3604 KiB
034.txt WA 2 ms 3456 KiB
035.txt WA 2 ms 3604 KiB
036.txt WA 2 ms 3452 KiB
037.txt WA 3 ms 3528 KiB
038.txt WA 5 ms 3492 KiB
039.txt WA 2 ms 3576 KiB
040.txt WA 4 ms 3456 KiB
041.txt WA 2 ms 3440 KiB
042.txt WA 4 ms 3576 KiB
043.txt WA 3 ms 3532 KiB
044.txt WA 2 ms 3560 KiB
045.txt WA 2 ms 3528 KiB
046.txt WA 2 ms 3532 KiB
047.txt WA 3 ms 3496 KiB
048.txt WA 2 ms 3436 KiB
049.txt WA 2 ms 3580 KiB
050.txt WA 2 ms 3572 KiB
051.txt WA 2 ms 3540 KiB
052.txt WA 2 ms 3500 KiB
053.txt WA 6 ms 3496 KiB
054.txt WA 3 ms 3524 KiB
055.txt WA 3 ms 3600 KiB
example0.txt AC 2 ms 3488 KiB
example1.txt AC 3 ms 3568 KiB