Submission #731820

# Submission time Handle Problem Language Result Execution time Memory
731820 2023-04-28T03:55:49 Z maeola Modsum (NOI12_modsum) C++17
25 / 25
1 ms 304 KB
// trans rights
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int N;
int X[6], Y[6];

int main(int argc, const char *argv[])
{
	scanf(" %d", &N);
	X[0] = 1;
	for (int k = 0; k < N; k++)
	{
		int u, v;
		scanf(" %d %d", &u, &v);
		memset(Y, 0, sizeof(Y));
		for (int r = u; r <= v; r++)
		{
			for (int i = 0; i < 5; i++)
				Y[(i + r) % 5] += X[i];
		}
		memcpy(X, Y, sizeof(X));
	}
	int ans = 0;
	for (int i = 0; i < 5; i++)
	{
		ans += X[i];
		ans += ((i * i * i * i + 2 * i * i) % 5) * X[i];
	}
	printf("%d", ans);
	return 0;
}

Compilation message

modsum.cpp: In function 'int main(int, const char**)':
modsum.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  scanf(" %d", &N);
      |  ~~~~~^~~~~~~~~~~
modsum.cpp:16:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |   scanf(" %d %d", &u, &v);
      |   ~~~~~^~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 304 KB Output is correct