Submission #70152

# Submission time Handle Problem Language Result Execution time Memory
70152 2018-08-22T11:53:41 Z MrTEK Palindromes (info1cup18_palindromes) C++14
65 / 100
254 ms 66288 KB
#include <bits/stdc++.h>

using namespace std;
#define mp make_pair
#define pb push_back
#define len(a) (int)a.size()
#define fi first
#define sc second
#define d1(w) cerr<<#w<<":"<<w<<endl;
#define d2(w,c) cerr<<#w<<":"<<w<<" "<<#c<<":"<<c<<endl;
#define d3(w,c,z) cerr<<#w<<":"<<w<<" "<<#c<<":"<<c<<" "<<#z<<":"<<z<<endl;
#define left isc+isc
#define right isc+isc+1
#define mid (l+r)/2
#define FAfi_IO ios_base::sync_with_fidio(false);
#define escl '\n'

typedef long long int ll;

const int maxn = 620;
const long long LINF = 1e18;
const int LOG = 31;
const int INF = 1e9;
const int N = 3e5 + 5;
const int M = 5;
const int SQ = 350;
const int MOD = 998244353;

typedef long long int lli;
typedef pair<int,int> pii;

long long ans;

int n;

bool check(int x) {

	int bas[10],t = 0;
	while(x) {
		bas[++t] = x % 10;
		x /= 10;
	}
	for (int i = 1 ; i <= t / 2 ; i++)
		if (bas[i] != bas[t - i + 1])
			return false;
	return true;
}

int main() {

	scanf("%d",&n);

	for (int i = 1 ; i <= n ; i++) {
		int x;
		scanf("%d",&x);
		if (check(x))
			ans += x;
	}
	printf("%lld\n",ans);
}

Compilation message

palindromes.cpp: In function 'int main()':
palindromes.cpp:51:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
  ~~~~~^~~~~~~~~
palindromes.cpp:55:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&x);
   ~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 632 KB Output is correct
2 Correct 5 ms 632 KB Output is correct
3 Correct 114 ms 5492 KB Output is correct
4 Correct 200 ms 12864 KB Output is correct
5 Correct 254 ms 22564 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 22596 KB Output is correct
2 Correct 4 ms 22680 KB Output is correct
3 Correct 69 ms 24096 KB Output is correct
4 Correct 124 ms 26964 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 22596 KB Output is correct
2 Correct 4 ms 22680 KB Output is correct
3 Correct 69 ms 24096 KB Output is correct
4 Correct 124 ms 26964 KB Output is correct
5 Correct 3 ms 26964 KB Output is correct
6 Correct 9 ms 27076 KB Output is correct
7 Correct 114 ms 30176 KB Output is correct
8 Correct 151 ms 34116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 632 KB Output is correct
2 Correct 5 ms 632 KB Output is correct
3 Correct 114 ms 5492 KB Output is correct
4 Correct 200 ms 12864 KB Output is correct
5 Correct 254 ms 22564 KB Output is correct
6 Correct 4 ms 22596 KB Output is correct
7 Correct 4 ms 22680 KB Output is correct
8 Correct 69 ms 24096 KB Output is correct
9 Correct 124 ms 26964 KB Output is correct
10 Correct 3 ms 26964 KB Output is correct
11 Correct 9 ms 27076 KB Output is correct
12 Correct 114 ms 30176 KB Output is correct
13 Correct 151 ms 34116 KB Output is correct
14 Correct 3 ms 34116 KB Output is correct
15 Correct 11 ms 34316 KB Output is correct
16 Correct 143 ms 38156 KB Output is correct
17 Correct 208 ms 46784 KB Output is correct
18 Correct 246 ms 56500 KB Output is correct
19 Runtime error 244 ms 66288 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
20 Halted 0 ms 0 KB -