Блог пользователя keko37

Автор keko37, история, 4 года назад, По-английски

Hi everyone!

The third round of COCI will be held tomorrow, December 11th at 14:00 UTC. You can access the judging system here. If you are not familiar with COCI contest format, we encourage you to read the announcement.

The round was prepared by Bartol, pavkal5, ominikfistric, and me.

Feel free to discuss the problems in the comment section after the contest ends.

Hope to see you tomorrow!

  • Проголосовать: нравится
  • +85
  • Проголосовать: не нравится

»
4 года назад, скрыть # |
 
Проголосовать: нравится +38 Проголосовать: не нравится

Would you consider adding rust, while we are at it? :)

»
4 года назад, скрыть # |
 
Проголосовать: нравится +17 Проголосовать: не нравится

Reminder: the contest starts in less than one hour!

»
4 года назад, скрыть # |
Rev. 11  
Проголосовать: нравится 0 Проголосовать: не нравится

Why is this code WA for Akcija sub-tasks 1 and 2?

const int N = 2003;
int n, k, w[N], d[N];
vector<int> v[N];
pair<ll,int> best_set[N];

int main() {
    cin.tie(0)->sync_with_stdio(0);
    cin >> n >> k;
    REP(i,1,n) cin >> w[i] >> d[i], v[d[i]].push_back(w[i]);
    REP(i,1,n) {
        if (v[i].empty()) continue;
        sort(v[i].begin(),v[i].end());
        best_set[1].first += v[i][0];
        best_set[1].second++;
    }
    cout << best_set[1].second << ' ' << best_set[1].first;
}
»
4 года назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится

How to solve E?

  • »
    »
    4 года назад, скрыть # ^ |
     
    Проголосовать: нравится +39 Проголосовать: не нравится
    Solution
»
4 года назад, скрыть # |
 
Проголосовать: нравится +6 Проголосовать: не нравится

How to solve C?

  • »
    »
    4 года назад, скрыть # ^ |
    Rev. 2  
    Проголосовать: нравится +15 Проголосовать: не нравится

    This may be abit late :P

    solution
»
4 года назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

What are the specs on the judge computers? My solution to C runs in 2.6s on max-size data on my machine, but got TLE when submitting.

»
4 года назад, скрыть # |
 
Проголосовать: нравится +6 Проголосовать: не нравится

For problem C(Akcija), does this idea help for a full credit soluton: https://stackoverflow.com/questions/33219712/find-k-th-minimum-sum-of-every-possible-subset? If so, may anyone please elaborate it?

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How task D (Ekoeko) can be solved?

  • »
    »
    4 года назад, скрыть # ^ |
     
    Проголосовать: нравится +11 Проголосовать: не нравится

    I don't have a formal proof of correctness, but here's how I solved it. Go through the left half, left-to-right, and whenever you encounter a letter for which you've already seen 50% of them, flag it (it needs to move to the other half). Do the same with the right half, working right-to-left. The minimum number of swaps to get the balance correct is to move all the left flagged letters to the start of the right side (without changing their order), and vice versa. Once you've got the sides balanced, you can permute the right side to match the left side (or vice versa, or meet somewhere in the middle, but there is a triangle inequality that prevents meeting in the middle from being any better).

    Rather than doing all the swaps, you can compute what the final string will look like. Then there are standard algorithms to determine the number of swaps required to implement a permutation in O(n log n) time.

»
4 года назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

The tasks, test data, and solutions are now published! You can find them here.

You can submit your solutions here (HONI).