Submission #531513

# Submission time Handle Problem Language Result Execution time Memory
531513 2022-03-01T01:01:10 Z Register Dijamant (COI16_dijament) C++14
27 / 100
424 ms 476 KB
#include <bits/stdc++.h>
using namespace std;
const int N=1005;
int tot;
map<string,int> id;
bitset<N> b[N];
void read(){
	string s;
	for(cin>>s;s!=";";cin>>s);
}
bool add(){
	string it;cin>>it;
	if(id[it]) {read();return 0;}
	string s;cin>>s;
	vector<int> v;
	for(cin>>s;s!=";";cin>>s){
		int x=id[s];
		if(!x) {read();return 0;}
		v.push_back(x);
	}
	int m=v.size();
	for(int i=0;i<m;i++) for(int j=i+1;j<m;j++){
		if(b[v[i]][v[j]]||b[v[j]][v[i]]) continue;
		if((b[v[i]]|b[v[j]]).count()) return 0;
	}
	id[it]=++tot;
	for(int x:v) b[tot]|=b[x],b[tot][x]=1;
	return 1;
}
int main(){
	int t;scanf("%d",&t);
	while(t--) puts(add()?"ok":"greska");
	return 0;
}

Compilation message

dijament.cpp: In function 'int main()':
dijament.cpp:31:13: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |  int t;scanf("%d",&t);
      |        ~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 3 ms 204 KB Output is correct
7 Correct 2 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 3 ms 204 KB Output is correct
7 Correct 2 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Incorrect 1 ms 204 KB Output isn't correct
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 424 ms 476 KB Output isn't correct
2 Halted 0 ms 0 KB -