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

Автор Shayan, 29 часов назад, По-английски

Note: The text editorials will be provided by the authors of the round. This video tutorial acts as an additional resource for those who prefer video over text, and not as a substitute for the text editorial.

2004A — Closest Point

Video

2004B — Game with Doors

Video

2004C — Splitting Items

Video

2004D — Colored Portals

Video

2004E — Not a Nim Problem

Video

2004F — Make a Palindrome

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

»
29 часов назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

BRUUUUHHHHHHH I didn't notice the change in B until after the contest :( such BS

»
27 часов назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

Will a tutorial on problem G appear?

»
20 часов назад, # |
  Проголосовать: нравится +48 Проголосовать: не нравится

Are there written solutions for the problems? My English listening is poor.

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

When is the text editorial?

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

WHERE D hacked ? anyone have test case ?

  • »
    »
    15 часов назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Yes, many people were hacked, including me on tl. I think many people had a problem because of the slow map<string,vector> structure

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

      I have looked at your code, and the problem is you are doing :

      for(auto z : mapic){
          //do something                    
      }
      

      In this code, z will copy each vector in the map once, so that is why your code is $$$O(nq)$$$, but if you change it to :

      for(auto &z : mapic){
          //do something                    
      }
      

      Then the vector will not be copied as you are only taking a reference to where does it exist.

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

Is it a tendency, that now we have video editorials instead text one? I don't know, right now, is it better or worse, but definetly text editorials provides faster acsess to solution idea, because reading is faster than watching video. On another hand video edits can be easier to understand, so I personally prefer there both would be

  • »
    »
    10 часов назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

    also text editorials often have hints that are really valuable when you're almost solving the problem

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

Can we solve D using DSU? If not why

  • »
    »
    12 часов назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    same doubt:(

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

    If you ONLY want to use DSU, it would have worked if the problem asked to tell whether it is possible to move from some city to other. However the problem asks to find the minimum cost of moving from one city to other, which is not possible to solve ONLY using DSU.

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

The sub-array of f problem is continuous, so you shouldn't use that much n*(n+1)*(n+2)/6

»
11 часов назад, # |
  Проголосовать: нравится +7 Проголосовать: не нравится

i prefer text editorials

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

where G

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

Is there any text tutorial? :(

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

Yoo everyone, I was trying to upsolve the problems and I submitted the code for problem D and decided to take a break and now when I came back, it's been over 15 mins but my code is still in the queue, idk wht to do

  • »
    »
    8 часов назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    As of writing this comment, it is processing submissions from 7 hours ago, so I think it's gonna take a while. :)

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

Can anyone tell me why the first code is getting AC but the second one got hacked and now is showing TLE? Same logic. But in first one im passing from left to right and in second one im passing from right to left.

Thanks!

Code 1

	public static void solve() {
		int n = ii(), k = ii();
		List<Integer> A = new ArrayList<>();
		for(int i = 0; i < n; ++i) {
			A.add(ii());
		}
		Collections.sort(A, (a , b) -> Integer.compare(b, a));
		for(int i = 0; i < n - 1; i += 2) {
			int d = A.get(i) - A.get(i + 1);
			int min = Math.min(k, d);
			A.set(i + 1, A.get(i + 1) + min);
			k -= min;
		}
		long alice = 0, bob = 0;
		for(int i = 0; i < n; ++i) {
			if(i % 2 == 0) alice += A.get(i);
			if(i % 2 != 0) bob += A.get(i);
		}
		System.out.println(alice - bob);
	}

Code 2

	public static void solve() {
		int n = ii(), k = ii();
		int [] A = iir(n);
		Arrays.sort(A);
		for(int i = n - 2; i >= 0; i -= 2) {
			int d = A[i + 1] - A[i];
			int min = Math.min(k, d);
			A[i] += min;
			k -= min;
		}
		long x = 0, alice = 0, bob = 0;
		for(int i = n - 1; i >= 0; --i) {
			if(x % 2 == 0) alice += A[i];
			if(x++ % 2 != 0) bob += A[i];
		}
		System.out.println(alice - bob);
	}
  • »
    »
    13 минут назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    There was a test case targeting Java Arrays.Sort which doesn't guarantee worst case O(n log n) time when used on primitive data types. Arrays.Sort uses a different algorithm on objects such as Lists or Integer[].

    It got me too QQ.

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

When will ratings get updated??