#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){
| ~~~~^~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |