Submission #675411

# Submission time Handle Problem Language Result Execution time Memory
675411 2022-12-27T08:36:01 Z Dan4Life Strange Device (APIO19_strange_device) C++17
0 / 100
3173 ms 464448 KB
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define int long long
const int maxn = (int)1e6+10;
int n, A, B;
pair<int,int> a[maxn];
unordered_map<int,unordered_map<int,bool>> vis;
int32_t main()
{
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n >> A >> B;
	for(int i = 0; i < n; i++) cin >> a[i].fi >> a[i].se; int i;
	for(i = 0; i < 10000000; i++){
		int x = (i+i/B)%A, y = i%B;
		//cout << x << " " << y << "\n";
		if(vis[x][y]) break; vis[x][y]=1;
	}
	for(int j = 0; j < n; j++) cout << min(a[j].se-a[j].fi+1, i) << "\n";
}

Compilation message

strange_device.cpp: In function 'int32_t main()':
strange_device.cpp:18:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   18 |   if(vis[x][y]) break; vis[x][y]=1;
      |   ^~
strange_device.cpp:18:24: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   18 |   if(vis[x][y]) break; vis[x][y]=1;
      |                        ^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 2472 ms 288344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1032 ms 408200 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Incorrect 267 ms 44208 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 989 ms 336900 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 989 ms 336900 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 989 ms 336900 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 3173 ms 464448 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 2472 ms 288344 KB Output isn't correct
3 Halted 0 ms 0 KB -