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

Автор atcoder_official, история, 23 месяца назад, По-английски

We will hold AtCoder Beginner Contest 387.

We are looking forward to your participation!

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

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

Wow! Looking forward to solve 5 problems.

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

I am Chinese.

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

Hope to accept the problem D!

»
23 месяца назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +3 Проголосовать: не нравится

I love the cuteness of the first 3 problems in ABC contests how submissive and obedient they are, I love the feelings of domination.

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

I sloved 2 problems.a&b

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

a and b were very easy. but c ? i could not find any technique.

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

E is so hard, even harder than F

»
23 месяца назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

In my opinion, the order of the problems isn't quite right. $$$D$$$ and $$$F$$$ are classic problems, while $$$C$$$ and $$$E$$$ require more thinking. The results show that fewer contestants solved $$$C$$$ than $$$D$$$, and fewer solved $$$E$$$ than $$$F$$$. The difference is almost double.

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

Atcoder needs to use more testers!

»
23 месяца назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +5 Проголосовать: не нравится

That's how I thought during this contest:

why there are so many 2025?

why 2025 is in every problem?

why 2025 is so special?

wait

ac-predictor tells that I could get a new rating of 2025?

2025 is so magical!

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

very educational contest for me. learned that pow doesnt give good precision + dijkstra is god damn slow.

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

I solved every problem except C today LOL

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

What is the intended solution of C? And any hint for E please?

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

    ans = count of snake numbers in [10, R] — count of snake numbers in [10, L — 1]

    Submission

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

    For E, try to think about the divisibility properties of two consecutive numbers. I tried first 10 and 11, 9 and 10 and so on... The good thing I figure out is that if you find some number with sum of digits 8 and divisible by 8, then the next number will have sum of digits 9 and be divisible by 9.

  • »
    »
    23 месяца назад, скрыть # ^ |
    ← Rev. 2  
    Проголосовать: нравится +2 Проголосовать: не нравится
    Hint 1
    Hint 2
    Hint 3
    Hint 4
    Hint 5
»
23 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

now i need to learn about functional graph, it has been haunting me in every contest

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

Didn't like C and E :(

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

Forgot to MOD the ans in F ,realised after contest ended :(

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

For problem G, the composition of formal power series is not needed.

The editorial calculated $$$F\circ G$$$ where $$$F=\sum_{i\leq 0}\frac{x^in^{i-2}}{i!}$$$. Distribute the $$$n^{i-2}$$$ factor into $$$G$$$, i.e., replace $$$G$$$ with $$$\frac{G}{n}$$$, and the problem becomes calculating the exponent of the formal power series.

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

why is this failing for problem D: code ?

i cant seem to figure out whats wrong here

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

    The minimum distance travelled to reach a node need not be the same from both directions (as explained in the diagram).

    It is also possible that a node is reachable only from 1 direction.

    So it is possible, for a node $$$(i, j)$$$, that the distance to $$$(i, j)$$$ is less when reached after a horizontal step, but the destination can only be reachable when $$$(i, j)$$$ is reached after a vertical step.

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

Problem C was really cool! Took a lot of time but felt very satisfied after solving it.

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

After I got stuck in C for 50 minutes:

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

Me while doing A-B : I can solve every problem in the world!!

Me at C : I think this is not the right world..

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

E is just testcases , D is garbage implementation ,score distribution is random,this contest sucks.

»
23 месяца назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +3 Проголосовать: не нравится

Personally surprised everyone found E hard; I personally found E to be surprisingly easy when considering that you can extend values by inserting 0 in the middle of the number and then working with "easy" divisibility rules that don't care about that (1,2,3,4,5,6,8,9, but especially 2,3 and 8,9 since they're consecutive and 1 and 5 can immediately be shown to be impossible to manipulate this way under the constraints, though pairing 3 and 4 can work as an alternate construction, specifically by extending (111,112) to (1011,1012), (10011, 10012), etc.).

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

For problem E, I solved it case by case, by using one of the following patterns:

starting with 11, 80, 62, 53, 35, 26, 17, while ending with all zeros. A really impressive constructive problem!

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

please tell me why I got wrong on D, I had wasted a lot of time and I am upset

#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
using namespace std;

int dd[1010][1010];
char a[1010][1010];
int visited[1010][1010];

int ans = 1e9;

void solve()
{
	int n, m;	cin >> n >> m;

	pii start, goal;

	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			cin >> a[i][j];
			if (a[i][j] == 'S')	
				start = {i, j};
			else if (a[i][j] == 'G')
				goal = {i, j};
		}
	}

	visited[start.first][start.second] = 1;

	vector<int> dx = {1, -1, 0, 0, 1, -1, 0, 0};
	vector<int> dy = {0, 0, 1, -1, 0, 0, 1, -1};

	for (int j = 0; j < 4; j++)
	{
		queue<pair<pii, pii>> q; q.push({start, {1145140000, 1919810000}});
		memset(dd, 0, sizeof(dd));
		memset(visited, 0, sizeof(visited));

		while (!q.empty())
		{
			auto moxi = q.front(); 
			q.pop();
			int x = moxi.first.first, y = moxi.first.second;
			pii d = moxi.second;

			for (int i = 0 + j; i < j + 4; i++)
			{
				int xx = x + dx[i], yy = y + dy[i];
				if (xx >= 1 && xx <= n && yy >= 1 && yy <= m && visited[xx][yy] == 0 && a[xx][yy] != '#' && (d.first != dx[i] && d.second != dy[i]))
				{
					visited[xx][yy] = 1;
					q.push({{xx, yy}, {dx[i], dy[i]}});
					dd[xx][yy] = dd[x][y] + 1;
				}
			}
		}

		if (!visited[goal.first][goal.second])	continue ;

		ans = min(ans, dd[goal.first][goal.second]);

	}

	if (ans == 1e9)	cout << -1 << endl;

	else cout << ans << endl;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);	cout.tie(0);

	solve();

	return 0;
}
»
23 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I'm sorry I didn't quite get editorial of E. So they just throw some constructions, then there are some dots implying that there are some more constructions? And why there won't be other twin numbers?

»
23 месяца назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Could someone please take a look at my solution for F? I believe it is O(NM) but it suspiciously TLE on 3 test cases. Link

My approach is quite straightforward (functional graph, cycle detection, dp with prefix sums) and is essentially the same as that of the official solution.

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

Stuck with C for 40 min. Maybe AtCoder should swap E and F?

»
23 месяца назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Can anyone please tell me what is wrong with my implementation of problem C, my approach is almost same as given in editorial. submission