Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

Dragonol's blog

By Dragonol, history, 6 years ago, In English

Today, when i submited a problem , it took 31ms .Then i wondered is there anyway faster than my way, so i went to dashboard and sort for the shortest execution time. There's a guy's code solved the problem only in 15ms, i copied his code and submit on my own but it took 31ms to execute. Can someone explain ???

#include<bits/stdc++.h>

using namespace std;

#define int long long

signed main() {
	int n, m; cin >> n >> m;
	int l = INT_MAX, r = INT_MIN, t = INT_MIN, b = INT_MAX;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			char c; cin >> c;
			if (c == 'B') {
				l = min(l, j);
				r = max(r, j);
				t = max(t, i);
				b = min(b, i);
			}
		}
	}
	cout << (t + b) / 2 + 1 << " " << (l + r) / 2 + 1 << endl;
}

Full text and comments »

  • Vote: I like it
  • -16
  • Vote: I do not like it