Submission #52016

# Submission time Handle Problem Language Result Execution time Memory
52016 2018-06-23T08:51:39 Z hyunuk(#1332) Fortune Telling 2 (JOI14_fortune_telling2) C++11
4 / 100
2000 ms 2664 KB
#include <stdio.h>
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <bitset>
#include <map>
#include <set>
#include <tuple>
#include <string.h>
#include <math.h>
#include <random>
#include <functional>
#include <assert.h>
#include <math.h>
#include <sstream>
#include <iterator>
#include <numeric>

using namespace std;

using i64 = long long int;
using ii = pair<int, int>;
using ii64 = pair<i64, i64>;

int card[200005][2];
int view[200005];

int main()
{
	int n, k;

	scanf("%d %d", &n, &k);

	for (int i = 0; i < n; i++)
		scanf("%d %d", &card[i][0], &card[i][1]);

	for (int i = 0; i < k; i++)
	{
		int t;
		scanf("%d", &t);

		for (int j = 0; j < n; j++)
		{
			if (card[j][view[j]] <= t)
				view[j] = (view[j] + 1) % 2;
		}
	}

	i64 ans = 0;

	for (int i = 0; i < n; i++)
		ans += card[i][view[i]];

	printf("%lld\n", ans);

	return 0;
}

Compilation message

fortune_telling2.cpp: In function 'int main()':
fortune_telling2.cpp:34:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &k);
  ~~~~~^~~~~~~~~~~~~~~~~
fortune_telling2.cpp:37:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &card[i][0], &card[i][1]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fortune_telling2.cpp:42:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &t);
   ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 5 ms 496 KB Output is correct
3 Correct 7 ms 556 KB Output is correct
4 Correct 8 ms 636 KB Output is correct
5 Correct 9 ms 636 KB Output is correct
6 Correct 7 ms 636 KB Output is correct
7 Correct 7 ms 636 KB Output is correct
8 Correct 5 ms 636 KB Output is correct
9 Correct 6 ms 728 KB Output is correct
10 Correct 6 ms 728 KB Output is correct
11 Correct 9 ms 728 KB Output is correct
12 Correct 7 ms 728 KB Output is correct
13 Correct 7 ms 728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 5 ms 496 KB Output is correct
3 Correct 7 ms 556 KB Output is correct
4 Correct 8 ms 636 KB Output is correct
5 Correct 9 ms 636 KB Output is correct
6 Correct 7 ms 636 KB Output is correct
7 Correct 7 ms 636 KB Output is correct
8 Correct 5 ms 636 KB Output is correct
9 Correct 6 ms 728 KB Output is correct
10 Correct 6 ms 728 KB Output is correct
11 Correct 9 ms 728 KB Output is correct
12 Correct 7 ms 728 KB Output is correct
13 Correct 7 ms 728 KB Output is correct
14 Correct 470 ms 1104 KB Output is correct
15 Correct 1914 ms 1764 KB Output is correct
16 Execution timed out 2052 ms 2664 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 5 ms 496 KB Output is correct
3 Correct 7 ms 556 KB Output is correct
4 Correct 8 ms 636 KB Output is correct
5 Correct 9 ms 636 KB Output is correct
6 Correct 7 ms 636 KB Output is correct
7 Correct 7 ms 636 KB Output is correct
8 Correct 5 ms 636 KB Output is correct
9 Correct 6 ms 728 KB Output is correct
10 Correct 6 ms 728 KB Output is correct
11 Correct 9 ms 728 KB Output is correct
12 Correct 7 ms 728 KB Output is correct
13 Correct 7 ms 728 KB Output is correct
14 Correct 470 ms 1104 KB Output is correct
15 Correct 1914 ms 1764 KB Output is correct
16 Execution timed out 2052 ms 2664 KB Time limit exceeded
17 Halted 0 ms 0 KB -