Different execution time !!!

Правка en1, от Dragonol, 2018-08-28 07:31:43

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;
}
Теги different execution time

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Dragonol 2018-08-28 10:27:32 144 Tiny change: '}\n~~~~~\n\n' -> '}\n~~~~~\n![ ](https://mirror.codeforces.com/1b24b2/a.jpg)\n'
en1 Английский Dragonol 2018-08-28 07:31:43 804 Initial revision (published)