Submission #531515

# Submission time Handle Problem Language Result Execution time Memory
531515 2022-03-01T01:17:42 Z Register Dijamant (COI16_dijament) C++14
100 / 100
526 ms 616 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 0 ms 300 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 0 ms 300 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 332 KB Output is correct
7 Correct 3 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 0 ms 300 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 332 KB Output is correct
7 Correct 3 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 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 2 ms 320 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 300 KB Output is correct
21 Correct 1 ms 300 KB Output is correct
22 Correct 1 ms 320 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 427 ms 616 KB Output is correct
2 Correct 526 ms 604 KB Output is correct
3 Correct 143 ms 492 KB Output is correct
4 Correct 3 ms 332 KB Output is correct
5 Correct 3 ms 460 KB Output is correct
6 Correct 8 ms 460 KB Output is correct
7 Correct 16 ms 512 KB Output is correct
8 Correct 24 ms 460 KB Output is correct
9 Correct 26 ms 460 KB Output is correct
10 Correct 7 ms 460 KB Output is correct
11 Correct 6 ms 500 KB Output is correct
12 Correct 368 ms 568 KB Output is correct