제출 #1285619

#제출 시각아이디문제언어결과실행 시간메모리
1285619ecen30선물 (IOI25_souvenirs)C++20
0 / 100
1 ms336 KiB
//This is Grok code. I am using this website to test different AI's and their abilities to solve IOI problems. Please understand. I do not mean to cheat. Just trying to get a good grade on my science project. #include <bits/stdc++.h> using namespace std; pair<vector<int>, long long> transaction(long long M); void buy_souvenirs(int N, long long P0) { vector<long long> P(N); P[0] = P0; // === 1. Discover all prices with ONE transaction === long long M = P0 - 1; auto [types, rem] = transaction(M); long long spent = M - rem; // Count how many of each type were bought vector<int> cnt(N, 0); int max_type = 0; for (int t : types) { cnt[t]++; max_type = max(max_type, t); } // Reconstruct prices from highest to lowest long long current = spent; for (int i = max_type; i >= 1; --i) { if (cnt[i] > 0) { P[i] = current / cnt[i]; current -= cnt[i] * P[i]; } } // === 2. Buy exactly i souvenirs of type i === for (int i = 1; i < N; ++i) { for (int j = 0; j < i; ++j) { transaction(P[i]); // buys exactly one type i } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...