Submission #105729

# Submission time Handle Problem Language Result Execution time Memory
105729 2019-04-14T06:47:45 Z Pro_ktmr Fireworks (APIO16_fireworks) C++14
0 / 100
20 ms 14464 KB
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define PB push_back
#define MP make_pair
#define MOD 1000000007

int N, M;
vector<pair<int, LL>> edge[300001];
int par[300001];
vector<pair<LL,int>> chi[300001];

void dfs(int now, int p){
	for(int i=0; i<edge[now].size(); i++){
		if(edge[now][i].first == p) continue;
		chi[now].PB(MP(edge[now][i].second, edge[now][i].first));
		par[edge[now][i].first] = now;
		dfs(edge[now][i].first, now);
	}
	sort(chi[now].begin(), chi[now].end());
}

int main(){
	scanf("%d%d", &N, &M);
	for(int i=0; i<N+M; i++){
		int P;
		LL C;
		C--;
		scanf("%d%lld", &P, &C);
		edge[i].PB(MP(P, C));
		edge[P].PB(MP(i, C));
	}
	
	par[0] = -1;
	dfs(0, -1);

	cout << 0 << endl;
}

Compilation message

fireworks.cpp: In function 'void dfs(int, int)':
fireworks.cpp:15:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<edge[now].size(); i++){
               ~^~~~~~~~~~~~~~~~~
fireworks.cpp: In function 'int main()':
fireworks.cpp:25:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &N, &M);
  ~~~~~^~~~~~~~~~~~~~~~
fireworks.cpp:30:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%lld", &P, &C);
   ~~~~~^~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 17 ms 14464 KB Output is correct
2 Incorrect 20 ms 14464 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 14464 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 17 ms 14464 KB Output is correct
2 Incorrect 20 ms 14464 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 17 ms 14464 KB Output is correct
2 Incorrect 20 ms 14464 KB Output isn't correct
3 Halted 0 ms 0 KB -