Submission #72444

# Submission time Handle Problem Language Result Execution time Memory
72444 2018-08-26T08:12:17 Z 마릴린 희정(#2180, gs14004, ho94949) Chocolate Cookie Machine (FXCUP3_chocolate) C++17
55 / 100
1120 ms 29180 KB
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 300005;

int n, m, k, chk[MAXN];
vector<int> gph[MAXN];
int stat[MAXN], mp[MAXN];

int main(){
	scanf("%d %d %d",&n,&m,&k);
	for(int i=0; i<m; i++){
		int x;
		scanf("%d",&x);
		chk[x] = 1;
	}
	for(int i=0; i<k; i++){
		int s, e;
		scanf("%d %d",&s,&e);
		gph[s].push_back(e);
		gph[e].push_back(s);
	}
	scanf("%d",&m);
	char sregy[4][10];
	bool fuck = false; // indicates, that ro something can be unsafe
	for(int i=0; i<m; i++){
		int x;
		scanf("%s %s %d %s %s", sregy[0], sregy[1], &x, sregy[2], sregy[3]);
		if(*sregy[3] == 'B') stat[x] = -1;
		if(*sregy[3] == 'O') stat[x] = 1;
		if(*sregy[3] == 'O') fuck = true;
	}
	vector<int> ret, adj, notadj;
	if(!fuck){
		for(int i=1; i<=n; i++){
			if(chk[i]) ret.push_back(i);
		}
	}
	for(int i=1; i<=n; i++){
		if(stat[i] == -1 && !chk[i]) adj.push_back(i);
		if(stat[i] == 1 && !chk[i]) notadj.push_back(i);
	}
	for(auto &i : adj){
		for(auto &j : gph[i]) mp[j]++;
	}
	int sz = adj.size(); adj.clear();
	for(int i=1; i<=n; i++){
		if(mp[i] == sz && !chk[i]) adj.push_back(i);
	}
	memset(mp, 0, sizeof(mp));
	for(auto &i : notadj){
		for(auto &j : gph[i]) mp[j] = 1;
	}
	for(auto &i : adj){
		bool fuck = false;
		for(auto &j : gph[i]){
			if(mp[j]) fuck = true;
		}
		if(!fuck) ret.push_back(i);
	}
	sort(ret.begin(), ret.end());
	cout << ret.size() << endl;
	for(auto &i : ret) printf("%d ", i);
}

Compilation message

chocolate.cpp: In function 'int main()':
chocolate.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d %d",&n,&m,&k);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~
chocolate.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&x);
   ~~~~~^~~~~~~~~
chocolate.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d",&s,&e);
   ~~~~~^~~~~~~~~~~~~~~
chocolate.cpp:22:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&m);
  ~~~~~^~~~~~~~~
chocolate.cpp:27:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s %s %d %s %s", sregy[0], sregy[1], &x, sregy[2], sregy[3]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 11 ms 8572 KB Output is correct
2 Incorrect 11 ms 8636 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 658 ms 20476 KB Output is correct
2 Correct 130 ms 20476 KB Output is correct
3 Correct 471 ms 20476 KB Output is correct
4 Correct 1016 ms 25288 KB Output is correct
5 Correct 485 ms 25288 KB Output is correct
6 Correct 99 ms 25288 KB Output is correct
7 Correct 1120 ms 29180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 8572 KB Output is correct
2 Incorrect 11 ms 8636 KB Output isn't correct
3 Halted 0 ms 0 KB -