Submission #32003764


Source Code Expand

Copy
//g++ -std=c++17 -Wl,--stack,268435456 Ahoyy.cpp -o Ahoyy.exe
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pld pair<ld,ld>
#define pb push_back
#define fi first
#define se second
#define UP(a,b,c) for(ll (a)=(b);(a)<(c);++(a))
#define UU(a,b,c) for(ll (a)=(b);(a)<=(c);++(a))
#define DN(a,b,c) for(ll (a)=(b);(a)>(c);--(a))
#define DU(a,b,c) for(ll (a)=(b);(a)>=(c);--(a))
#define lc(i) i+1
#define rc(i) i+(m-l+1)*2
#include <ext/pb_ds/assoc_container.hpp>
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
//g++ -std=c++17 -Wl,--stack,268435456 Ahoyy.cpp -o Ahoyy.exe

#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pld pair<ld,ld>
#define pb push_back
#define fi first
#define se second
#define UP(a,b,c) for(ll (a)=(b);(a)<(c);++(a))
#define UU(a,b,c) for(ll (a)=(b);(a)<=(c);++(a))
#define DN(a,b,c) for(ll (a)=(b);(a)>(c);--(a))
#define DU(a,b,c) for(ll (a)=(b);(a)>=(c);--(a))
#define lc(i) i+1
#define rc(i) i+(m-l+1)*2

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

ll expo(ll a, ll b, ll mod) {
	if(b == 0) return 1;
	if(b == 1) return a % mod;
	ll ret = expo(a, b>>1, mod);
	ret *= ret;
	if(ret >= mod) ret %= mod;
	if(b & 1) {
		ret *= a;
		if(ret >= mod) ret %= mod;
	}
	return ret;
}

ll inv(ll v, ll mod) {
	return expo(v, mod - 2, mod);
}

int r, c;
vector<pii> p;

void reset() {
}

void input() {
	cin >> r >> c;
	UU(j, 1, r) UU(i, 1, c) {
		char ch;
		cin >> ch;
		if(ch == 'o') {
			p.pb({i, j});
		}
	}

	cout << abs(p[0].fi - p[1].fi) + abs(p[0].se - p[1].se) << endl;
}

void solve() {
}

void Ahoy() {
	solve();
}

int main() {
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	// freopen("in.txt", "r", stdin);

	int TC = 1;
	// cin >> TC;
	UU(t, 1, TC) {
		// cout << "Case #" << t << ": ";
		input();
		Ahoy();
		reset();
	}

	return 0;
}

Submission Info

Submission Time
Task B - Distance Between Tokens
User kresna
Language C++ (GCC 9.2.1)
Score 200
Code Size 1733 Byte
Status AC
Exec Time 8 ms
Memory 3652 KB

Compile Error

./Main.cpp: In function ‘void input()’:
./Main.cpp:15:26: warning: unnecessary parentheses in declaration of ‘j’ [-Wparentheses]
   15 | #define UU(a,b,c) for(ll (a)=(b);(a)<=(c);++(a))
      |                          ^
./Main.cpp:55:2: note: in expansion of macro ‘UU’
   55 |  UU(j, 1, r) UU(i, 1, c) {
      |  ^~
./Main.cpp:15:26: warning: unnecessary parentheses in declaration of ‘i’ [-Wparentheses]
   15 | #define UU(a,b,c) for(ll (a)=(b);(a)<=(c);++(a))
      |                          ^
./Main.cpp:55:14: note: in expansion of macro ‘UU’
   55 |  UU(j, 1, r) UU(i, 1, c) {
      |              ^~
./Main.cpp: In function ‘int main()’:
./Main.cpp:15:26: warning: unnecessary parentheses in declaration of ‘t’ [-Wparentheses]
   15 | #define UU(a,b,c) for(ll (a)=(b);(a)<=(c);++(a))
      |                          ^
./Main.cpp:79:2: note: in expansion of macro ‘UU’
   79 |  UU(t, 1, TC) {
      |  ^~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 2
AC × 13
Set Name Test Cases
Sample example_00.txt, example_01.txt
All example_00.txt, example_01.txt, test_00.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt
Case Name Status Exec Time Memory
example_00.txt AC 8 ms 3596 KB
example_01.txt AC 2 ms 3580 KB
test_00.txt AC 2 ms 3468 KB
test_01.txt AC 2 ms 3544 KB
test_02.txt AC 3 ms 3584 KB
test_03.txt AC 2 ms 3612 KB
test_04.txt AC 2 ms 3580 KB
test_05.txt AC 2 ms 3528 KB
test_06.txt AC 2 ms 3652 KB
test_07.txt AC 2 ms 3524 KB
test_08.txt AC 2 ms 3528 KB
test_09.txt AC 2 ms 3600 KB
test_10.txt AC 2 ms 3540 KB


2025-02-28 (Fri)
05:16:16 +00:00