Submission #712590

# Submission time Handle Problem Language Result Execution time Memory
712590 2023-03-19T08:49:02 Z vjudge1 Dijamant (COI16_dijament) C++14
0 / 100
4 ms 4088 KB
#include <bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

#define ii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vii vector<ii>
#define vll vector<ll>
#define vpll vector<pll>
#define msi multiset<int>
#define si set<int>
#define PB push_back
#define PF push_front
#define PPB pop_back
#define PPF pop_front
#define X first
#define Y second
#define MP make_pair
#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()

const int mod = 1e9 + 7;
const int MOD = 998244353;
const int inf = mod;
const ll INF = 1e18;
const int logo = 20;
const int MAXN = 1e3 + 7;
const int off = 1 << logo;
const int trsz = off << 1;

bitset<MAXN> cvis[MAXN][2];
vi g[MAXN], pg[MAXN];
int nod = 1, pnod = 1;
map<string, int> ids, pids;


void failalo(){
	FOR(i, 1, pnod) g[i] = pg[i];	
	nod = pnod;
	ids = pids;
	cout << "greska\n";
}


void check(){
	pids = ids;
	pnod = nod;
	FOR(i, 1, nod) pg[i] = g[i];
	string s = "";
	while(s.empty()) getline(cin, s);
	
	string fir = "";
	for(auto &x : s){
		if(x == ' ') break;
		fir += x;
	}
	
	if(ids[fir]){
		failalo();
		return;
	}
	ids[fir] = nod++;
	vi sus; sus.clear();
	int nid = fir.size() + 3;
	while(nid < s.size() - 1){
		string cur = "";
		while(s[nid] != ' ') cur += s[nid++];
		nid++;
		if(ids[cur]) sus.PB(ids[cur]);
		else{
			failalo();
			return;
		}
	}
	
	cout << "ok\n";
}

void solve(){
	int n;
	cin >> n;
	REP(i, n) check();
}


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t=1;
	//cin >> t;
	while(t--)solve();
	return 0;
}



Compilation message

dijament.cpp: In function 'void check()':
dijament.cpp:73:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   73 |  while(nid < s.size() - 1){
      |        ~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 4088 KB Output isn't correct
2 Halted 0 ms 0 KB -