Submission #90882

# Submission time Handle Problem Language Result Execution time Memory
90882 2018-12-25T05:42:48 Z YottaByte Trading (IZhO13_trading) C++14
0 / 100
2000 ms 2248 KB
#include <stdio.h>
#include <stdlib.h>
#include <iomanip>
using namespace std;

#define pb push_back
#define fr first
#define endl '\n'
#define sc second

const int N = 3e5 + 1;
int a[N], n, m;

void fill(int l, int r, int x)
{
	for(int i = l; i <= r; i++)
	{
		a[i] = max(a[i], x++);
	}
}

main()
{
	scanf("%d%d", &n, &m);
	for(int i = 1; i <= m; i++)
	{
		int l, r, x;
		scanf("%d%d%d", &l, &r, &x);
		fill(l, r, x);
	}
	
	for(int i = 1; i <= n; i++)
		printf("%d ", a[i]);
}
/**
5 2
1 3 2
2 4 6
**/

Compilation message

trading.cpp:22:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
trading.cpp: In function 'int main()':
trading.cpp:24:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &n, &m);
  ~~~~~^~~~~~~~~~~~~~~~
trading.cpp:28:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d%d", &l, &r, &x);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 388 KB Output is correct
3 Correct 2 ms 420 KB Output is correct
4 Correct 2 ms 420 KB Output is correct
5 Correct 3 ms 420 KB Output is correct
6 Correct 4 ms 508 KB Output is correct
7 Correct 1349 ms 1828 KB Output is correct
8 Execution timed out 2023 ms 2248 KB Time limit exceeded
9 Halted 0 ms 0 KB -