How does this code pass all testcases?

Revision en1, by neat, 2020-04-15 12:27:18

76778492 ~~~~~~

include <bits/stdc++.h>

using namespace std; int main() { long long t, n, p; cin >> t; while(t--) { p = 0; cin >> n; for(int i=0; i<n; i++) for(int j=0; j<n; j++) for(int k = 0; k < n; k++) for(int l = 0; l < n; l++) for(int m = 0; m < n; m++) for(int o = 0; o < n; o++) p++; p -= p; cout << p + n << "\n"; } return 0;

} ~~~~~~ Above is one of my Accepted submissions for problem 1339A — Filling Diamonds from Codeforces Round #633 (Div. 2). The answer for the problem is same as the input $$$n$$$ for each testcase. Its complexity is $$$O(n^6)$$$ per testcase. Here $$$1 <= n <= 10^9$$$. I am wondering how it passed all testcases. Kindly write your thoughts in the comments section.

Tags #timelimit, #accepted

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English neat 2020-04-15 12:28:09 4
en1 English neat 2020-04-15 12:27:18 886 Initial revision (published)