Different execution time !!!

Revision en2, by Dragonol, 2018-08-28 10:27:32

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;
}

Tags different execution time

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Dragonol 2018-08-28 10:27:32 144 Tiny change: '}\n~~~~~\n\n' -> '}\n~~~~~\n![ ](https://mirror.codeforces.com/1b24b2/a.jpg)\n'
en1 English Dragonol 2018-08-28 07:31:43 804 Initial revision (published)