Connection Status:
Competition Arena > Submission #25
System Testing
1 / 68
WA 1/68 test cases passed
Submission #25
ProblemSantaGifts
HandleNur Ahmad Wahid
Submitted2026-07-24 03:22:12
System Messages
Test case #1
Input:    {"ball","plane","robot","puzzle","bike"}
Input:    1
Expected: {"ball plane robot puzzle" }
Got:      {"ball plane robot puzzle bike"}
Source Code
// g++ -std=c++17 a.cpp -o a; ./a

#include <iostream>
#include <vector>
#include <string>

using namespace std;

#define ll long long

const int INF = 1e9;
const ll LINF = 1e18;

class SantaGifts {
    public:
        vector<string> distribute(vector<string> gifts, int N)
        {
            int n_gifts = gifts.size();
            vector<string> res(N, "");
            int ctr = 0;
            for (int i=0;i<n_gifts;i++) {
                if (ctr == N) {
                    ctr = 0;
                }
                if (res[ctr] == "") {
                    res[ctr] = gifts[i];
                } else {
                    res[ctr] += " " + gifts[i];
                }
                ctr++;
            }

            return res;
        }
};